x = c("stage 1-1", "stage 2-2", "stage 3-2")
y = c("stage 1-1", "stage 1-2", "stage 2-2")
z = c("stage 3-2", "stage 2-1", "stage 3-4")
df <- data.frame(x, y, z)
I'm new in R, and I have this dataframe name as df.
However, I want to change stage o-x to just stage o using if else.
For example, stage 2-2 to stage 2 or stage 3-4 to stage 3.
Could you tell me how to do it?
Aucun commentaire:
Enregistrer un commentaire