0
  ld=list(c(X10 = 7, X11 = 1, X13 = 6, X14 = 8), c(X10 = NA, X11 = 5, X12 = 
  8,X13 = 8,  X15 = 9))

In order to r bind this list I use.

       do.call(rbind, ld)

However it is doing wrong : The correct shoud fill the missing ones (ex x12 and x15) with NA :

Desired output :

      X10 X11 X12 X13 X14 X15
[1,]   7   1   NA   6   8  NA
[2,]  NA   5   8   8   NA   9
temor
  • 935
  • 2
  • 10
  • 26

1 Answers1

1

using purrr, magrittr and plyr

ld %>% map(~as.matrix(.) %>% t  %>% as.data.frame) %>% do.call(plyr::rbind.fill, .)

result:

  X10 X11 X13 X14 X12 X15
1   7   1   6   8  NA  NA
2  NA   5   8  NA   8   9
Andre Elrico
  • 10,956
  • 6
  • 50
  • 69