colsplit
in package reshape2
can be used to split character data:
colsplit(c("A_1", "A_2", "A_3"), pattern="_", c("Letter", "Number"))
Letter Number
1 A 1
2 A 2
3 A 3
In his paper "Rehaping data with the Reshape Package", Hadley Wickham gives an example of using colsplit
to split data into individual characters. His example should produce the above from the data c("A1", "A2", "A3")
which he does by omitting the pattern argument. But this throws an error.
The documentation for str_split_fixed
which colsplit
calls says that setting pattern=""
will split into individual characters, but this does not work.
Is there any way to use colsplit
so that it splits into individual character.
This is R 3.1.1 and packages are up to date.