Removing curly brackets in R

gsubr

How to remove curly brackets in R?
Eg. "{abcd}" to "abcd"

How can I use gsub function in R to do this? If any other method is available, please suggest.

Best Answer

Try this

gsub("\\{|\\}", "", "{abcd}")
[1] "abcd"

Or this

gsub("[{}]", "", "{abcd}")
Related Topic