I have a character vector in which each element is enclosed in brackets. I want to remove the brackets and just have the string.
So I tried:
n = c(\"
If working within tidyverse:
library(tidyverse); library(stringr) n = c("[Dave]", "[Tony]", "[Sara]") n %>% str_replace_all("\\[|\\]", "") [1] "Dave" "Tony" "Sara"