My list (l) contains different Data Frames of different length.
x1, x2 and x3 are values of different product-variables.
y is a factor variable from 1 to 15.
I struggle how to match or join those Data Frames by the correct but unequal distributed factor-variable y.
df1 <- data.frame(x1=c(100,10,20,70,30), y =as.factor(c(1,2,3,11,15)))
df2 <- data.frame(x2=c(11,22,33,44,55,66,77,88,99), y =as.factor(c(1,2,3,4,5,7,8,11,12)))
df3 <- data.frame(x3=c(11,12,13,14,15,16,17,18,19,20), y =as.factor(c(1,2,3,4,5,11,12,13,14,15)))
l <- list(df1,df2,df3)
Often recommended, but in this case not working is the following line:
do.call(rbind.fill, l)
My expected output is ONE, new Data Frame or table like this:
x1 x2 x3
1 100 11 11
2 10 22 12
3 20 33 13
4 NA 44 14
5 NA 55 15
6 NA NA NA
7 NA 66 NA
8 NA 77 NA
9 NA NA NA
10 NA NA NA
11 70 88 16
12 NA 99 17
13 NA NA 18
14 NA NA 19
15 30 NA 20