How can I get the second table (table2) from the first one (table1) without using any loops?
table1 <- data.frame(stringsAsFactors=FALSE,
x = c("1,2,3"),
y = c("a,b,c,d"),
z = c("e,f"))
table1
|x |y |z |
|:-----|:-------|:---|
|1,2,3 |a,b,c,d |e,f |
table2 <- data.frame(stringsAsFactors=FALSE,
x = c(1, 2, 3, NA),
y = c("a", "b", "c", "d"),
z = c("e", "f", NA, NA))
table2
| x|y |z |
|--:|:--|:--|
| 1|a |e |
| 2|b |f |
| 3|c |NA |
| NA|d |NA |