I would like to split the following string by its periods. I tried strsplit()
with "."
in the split
argument, but did not get the result I want.
s <- "I.want.to.split"
strsplit(s, ".")
[[1]]
[1] "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
The output I want is to split s
into 4 elements in a list, as follows.
[[1]]
[1] "I" "want" "to" "split"
What should I do?