0

I'm trying to get rid of the words and brackets in a column. I'm trying to get rid of '(AGE)'. I tried using df7$disaggregation=gsub(" (AGE)","",df7$disaggregation)but the brackets I'm trying to get rid of is throwing it off, and it only returns '()'. Any tips?

  • 1
    Try `gsub(" \\(AGE\\)", "", df7$disaggregation)`. The parentheses are metacharacters. See `?regex` for the manual page. If that does not work use `dput(head(df7$aggregation, 10))` to provide the first 10 values in df7$aggregation. – dcarlson Sep 08 '22 at 04:41
  • You can try the `fixed` argument too: `gsub(" (AGE)", "", df7$disaggregation, fixed = TRUE)`. – neilfws Sep 08 '22 at 04:50

0 Answers0