I have some data that looks like this:
n <- ("String [a]", "String2 [b]")
I'd like to remove the brackets and everything within them so I get this:
n <- ("String", "String2")
The code I have is:
gsub("\\[*]", "", n)
Which doesn't work because the \ mean R interprets the wildcard * literally. How do I fix this? Thanks!