I would like to split the string x = "a,b,"
(comma at the last place) into the vector c("a","b","")
using strsplit().
The result is:
>strsplit(x,',')
[[1]]
[1] "a" "b"
I would like the have the third component (empty string or NULL).
The function read.csv(x)
can manage that, but still I think that strsplit()
should behave as I expected. Python gives c("a","b","")
.
Maybe there is some option of strsplit()
I do not know?