Displaying 1 result from an estimated 1 matches for "2003_mary_teamy".
2011 Feb 04
2
recode according to specific sequence of characters within a string variable
Dear R-List,
I have a dataframe with one column "name.of.report" containing character values, e.g.
>df$name.of.report
"jeff_2001_teamx"
"teamy_jeff_2002"
"robert_2002_teamz"
"mary_2002_teamz"
"2003_mary_teamy"
...
(i.e. the bit of interest is not always at same position)
Now I want to recode the column "name.of.report" into the variables "person", "year","team", like this
>new.df
"person" "year" "team"
jeff 2001...