How can I split the column rn into two columns with Base R?
I tried strsplit(schluempfe$rn, ".", fixed=TRUE)
which splits successfully but I do not know how to get two columns with this function. Do I need to bind them back with cbind()?
If this is not possible I will revert to separate() or str_split_fixed() but it "seems simple enough" for Base R.
> str(schluempfe)
Classes ‘data.table’ and 'data.frame': 13534 obs. of 2 variables:
$ rn : chr "oberschlumpf.2020-05-13" "oberschlumpf.2020-05-12"
"oberschlumpf.2020-05-11" "oberschlumpf.2020-05-10" ...
$ reCNru: num 15.9 19.2 25.2 21.3 18.6 ...
- attr(*, ".internal.selfref")=<externalptr>
As output I would like to see
Classes ‘data.table’ and 'data.frame': 13534 obs. of 3 variables:
$ rn1 : chr "oberschlumpf" "oberschlumpf" "oberschlumpf" "oberschlumpf" ...
$ rn2 : chr "2020-05-130" "2020-05-12" "2020-05-11" "2020-05-10" ...
$ reCNru: num 15.9 19.2 25.2 21.3 18.6 ...
- attr(*, ".internal.selfref")=<externalptr>