I need help with removal of asterisk and brackets from my dataset.
My dataset which includes * at the end of few values in a particular column such as ABC Imports* . It also includes some values within brackets like Imports (ABC).
I am trying to remove only * and only brackets in these values. I tried str_replace, str_remove and even gsub, however, it doesn't work .
Example of str_replace
df <- df %>%
str_replace(Column_name, "Imports*", "Imports")
It throws me error saying "unused argument ("Imports")
Both asterisks and parentheses are special characters in regular expressions and need to be escaped with backslashes. Here is a simple example of what I think you want to do. The pipe, |, in the regular expression means "or".