Good day everyone,
Please how do I remove both [ ] in a column using stringr? I.e,
"["action", "fantasy", "animation "]"
"["drama", "documentation","family"]"
Thank you!
Good day everyone,
Please how do I remove both [ ] in a column using stringr? I.e,
"["action", "fantasy", "animation "]"
"["drama", "documentation","family"]"
Thank you!
"[" and "]" are special characters with a defined meaning in regular expressions, you need to escape these characters with "\".
strings = c("[action, fantasy, animation]",
"[drama, documentation,family]")
strings
str_remove_all(strings, "(\\[)|(\\])")
[1] "action, fantasy, animation" "drama, documentation,family"
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.