I've got a list of vectors that take this form:
> g
[[1]]
[1] "L" "14" "L" "39" "L" "61" "B" "0" "L" "15" "L" "59" "W" "64"
[[2]]
[1] "L" "62" "D" "31" "L" "10" "L" "30" "B" "0" "D" "45" "L" "43"
[[3]]
[1] "H" "0" "L" "11" "L" "35" "W" "45" "H" "0" "L" "40" "L" "42"
My goal is to use mapply
on this structure and turn each of the 14 columns into a vector. The first column would be:
[[1]]
[1] "L"
[[2]]
[1] "L"
[[3]]
[1] "H"
And the second column would be:
[[1]]
[1] "14"
[[2]]
[1] "62"
[[3]]
[1] "0"
and so on. I suspect the structure would be a matrix (?) but I'm not sure. I used a lot of lapply
and stringr
's str_extract_all
with regex to get this point but I am unsure how to proceed. I suspect the function would use a pattern like: "[A-Z]{1}"
for the text and "[:digit:]{1}"
and I know that mapply
can return a matrix but I don't know where to begin.