I start with list l1
, which I want to convert to output
. As such, the data frames in l1
need to be merged by their first column (A).
df1 <- read.table(text="
A B
1 3
2 4 ", header=T)
df2 <- read.table(text="
A C
1 8
3 9 ", header=T)
l1 <- list(df1, df2); l1
output <- read.table(text="
A B C
1 3 8
2 4 NA
3 NA 9 ", header=T); output