I have the following elements in a list and I want to collapse them into a data frame where only the same columns across the list are retained.
I tried the following but it doesn't give me exactly what I want. Since it just NAs the columns that aren't in the other element. I would be even better to be able to choose which columns to collapse on.
n.obs <- sapply(lst, length)
seq.max <- seq_len(max(n.obs))
mat <- t(sapply(lst, "[", i = seq.max))
lst[[1]]
$id
[1] "akromils-production"
$name
[1] "Akro-Mils Production"
$month
[1] 12000
$year
[1] 137000
$units
[1] 3000
$clients
[1] 6
$pbox
[1] FALSE
$punits
[1] 0
$cbox
[1] FALSE
$cunits
[1] 0
$sbox
[1] FALSE
$sunits
[1] 0
$eval
[1] FALSE
$public
[1] FALSE
lst[[2]]
$id
[1] "adc-production-2"
$name
[1] "American Diagnostics - Production (2)"
$month
[1] 26000
$year
[1] 312000
$units
[1] 650
$clients
[1] 2
$pbox
[1] TRUE
$punits
[1] 650
$eval
[1] FALSE
$public
[1] FALSE