I have a list with a large number of dataframes, all the dataframes have the same columns. I need to split one column into two.
Here is a working example:
myList <- list(A = data.frame(ID = c("A:234", "A:345"),
Test = c(1, 1),
Value = 1:2),
B = data.frame(ID = c("B:5565", "B:2415", "B:65684"),
Test = c(1, 3, 5),
Value = 1:3))
Here is what I would like to get:
myList <- list(A = data.frame(ch = c("A", "A"),
pos = c(234,345),
Test = c(1, 1),
Value = 1:2),
B = data.frame(ch = c("B", "B", "B"),
pos=c(5565,2415,65684),
Test = c(1, 3, 5),
Value = 1:3))
I have traid to use splitstackshape::cSplit with lappy, but without success.