可能是这样的...
lapply(List, apply, 1, table) # table by row
lapply(List, apply, 2, table) # table by cols
输出不是很好。
更好的输出可能是:
list1 <- lapply(List, apply, 1, table) # table by row
list2 <- lapply(List, apply, 2, table) # table by cols
> # for list1
> lapply(list1, unlist) # output is a list
[[1]]
0 a 1 b 0 c 2 e 0 1 f 0 d
2 1 2 1 2 1 2 1 1 1 1 2 1
[[2]]
0 1 e 0 2 f 1 g 0 2 h 0 1 i 0 3 l
1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1
> # for list2
> library(abind)
> # using abind function from abind package
> abind(lapply(list2, unlist), along=0) # output is an array
GN.e GN.f GN.g GN.h GN.i GN.l SN1.0 SN1.1 SN1.2 SN1.3 SN2.0 SN2.1
[1,] 1 1 1 1 1 1 4 1 1 3 2 1
[2,] 1 1 1 1 1 1 1 2 2 1 4 2
> # R base solution
> do.call(rbind, lapply(list2, unlist)) # output is an array
GN.a GN.b GN.c GN.d GN.e GN.f SN1.0 SN1.1 SN1.2 SN2.0 SN2.1 SN2.2
[1,] 1 1 1 1 1 1 4 1 1 3 2 1
[2,] 1 1 1 1 1 1 1 2 2 1 4 2