名前付きベクトルのリストがあります (dput
バージョンについては以下と最後を参照してください)。一緒に「マージ」して行列を作成し、ベクトルに名前 (この場合は文字) が含まれていない場合はゼロを埋めたいと思います。これはそれほど難しいことではないようですが、問題に対する基本的な解決策は見つかりませんでした。do.call
match を使用することを考えましたが、and rbind
togetherを使用するおしゃれな方法があると確信している場合、それは非常に時間がかかるようです。
名前付きベクトルのリスト:
$greg
e i k l
1 2 1 1
$sam
! c e i t
1 1 1 2 1
$teacher
? c i k l
1 1 1 1 1
最終的に必要な出力
! ? c e i k l t
greg 0 0 0 1 2 1 1 0
sam 1 0 1 1 2 0 0 1
teacher 0 1 1 0 1 1 1 0
おそらくこれは人々が与える出力であり、NAを0で埋めるのは簡単です
! ? c e i k l t
greg NA NA NA 1 2 1 1 NA
sam 1 NA 1 1 2 NA NA 1
teacher NA 1 1 NA 1 1 1 NA
サンプルデータ
L2 <- structure(list(greg = structure(c(1L, 2L, 1L, 1L), .Dim = 4L, .Dimnames = structure(list(
c("e", "i", "k", "l")), .Names = ""), class = "table"), sam = structure(c(1L,
1L, 1L, 2L, 1L), .Dim = 5L, .Dimnames = structure(list(c("!",
"c", "e", "i", "t")), .Names = ""), class = "table"), teacher = structure(c(1L,
1L, 1L, 1L, 1L), .Dim = 5L, .Dimnames = structure(list(c("?",
"c", "i", "k", "l")), .Names = ""), class = "table")), .Names = c("greg",
"sam", "teacher"))