将列表绑定到一个矩阵中

时间:2015-03-27 23:17:44

标签: r

我正在尝试对列表数据中的每个元素进行处理。

head(data)
[[1]]
   Day 1
1    1 S
2    1 0
3    1 C
4    1 S
5    1 0
6    1 C
7    1 S
[[2]]
  Day 2
1   2 N
2   2 0
3   2 C
4   2 N
5   2 0
6   2 D

[[3]]
  Day 3
1   3 N
2   3 0
3   3 D

我尝试过do.call(rbind,data)。我收到错误:

Error in match.names(clabs, names(xi)) : 
  names do not match previous names

我该怎么办?我希望有一个包含所有这些元素的矩阵。我不希望它采用列表格式。

dput(数据):

dput(data)
list(structure(list(Day = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), `1` = structure(c(5L, 1L, 2L, 
5L, 1L, 2L, 5L, 1L, 2L, 5L, 1L, 2L, 5L, 1L, 2L, 5L, 1L, 2L, 4L, 
1L, 2L, 4L, 1L, 2L, 4L, 1L, 2L, 4L, 1L, 2L, 4L, 1L, 3L), .Names = c("Eligibility", 
"Intelligent.Method", "Status", "Eligibility.1", "Intelligent.Method.1", 
"Status.1", "Eligibility.2", "Intelligent.Method.2", "Status.2", 
"Eligibility.3", "Intelligent.Method.3", "Status.3", "Eligibility.4", 
"Intelligent.Method.4", "Status.4", "Eligibility.5", "Intelligent.Method.5", 
"Status.5", "Eligibility.6", "Intelligent.Method.6", "Status.6", 
"Eligibility.7", "Intelligent.Method.7", "Status.7", "Eligibility.8", 
"Intelligent.Method.8", "Status.8", "Eligibility.9", "Intelligent.Method.9", 
"Status.9", "Eligibility.10", "Intelligent.Method.10", "Status.10"
), .Label = c("0", "C", "G", "N", "S"), class = "factor")), .Names = c("Day", 
"1"), row.names = c(NA, -33L), class = "data.frame"), structure(list(
    Day = c(2L, 2L, 2L, 2L, 2L, 2L), `2` = structure(c(4L, 1L, 
    2L, 4L, 1L, 3L), .Names = c("Eligibility", "Intelligent.Method", 
    "Status", "Eligibility.1", "Intelligent.Method.1", "Status.1"
    ), .Label = c("0", "C", "D", "N"), class = "factor")), .Names = c("Day", 
"2"), row.names = c(NA, -6L), class = "data.frame"), structure(list(
    Day = c(3L, 3L, 3L), `3` = structure(c(3L, 1L, 2L), .Names = c("Eligibility", 
    "Intelligent.Method", "Status"), .Label = c("0", "D", "N"
    ), class = "factor")), .Names = c("Day", "3"), row.names = c(NA, 
-3L), class = "data.frame"))

0 个答案:

没有答案