I have a list of vectors and want to split it into elements such as
a <- list(~X1+X2, ~X2+X3)
strsplit(gsub("~", "", a[[2]])[2], "+", fixed = TRUE)[[1]]
and it gives me
"X2 " " X3 "
I want to have separate elements without blank spaces “X2”, “X3”. How can I escape the blank spaces?