I have a data frame done this way:
a b c -------------------------------- 1 2011 mal ID9 2 2012 yesterday ID10 3
This should work
z$c=gsub(" ID.*","",z$c)
You can try something like this:
z %>% mutate(c = gsub("\\sID\\d+$", "", c)) a b c 1 1 2011 mal 2 2 2012 yesterday 3 3 2010 misch 4 4 1995 mal 5 5 2008 se 6 6 1998 falling 7 7 2011 friend 8 8 2011 use to be