samedi 9 mai 2015

Remove characters from string based on relative position to specific character, in R

How to remove all characters before "p", and "p" itself, in all strings of v1 as in data frame below.

df1 <- data.frame(v1 = c("m0p1", "m5p30", "m11p20", "m59p60")) 

How to remove all characters after "p" and "p" itself? Thank you

Aucun commentaire:

Enregistrer un commentaire