0

I am trying to rbind each element in my list data.

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

I tried doing do.call(rbind,data). I get the error:

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

What should I do? I want to have one matrix with all these elements in it. I do not want it to be in a list format.

dput(data):

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"))
  • post the output of `dput(data)` – Avinash Raj Mar 27 '15 at 23:19
  • Well, the error seems reasonably clear. In what sense did you think that `1==2` and `2==3`? (This have been asked repeatedly on SO.) – IRTFM Mar 27 '15 at 23:26
  • I know, but how do I fix it? I need to make them one matrix with two columns. – user3554354 Mar 27 '15 at 23:30
  • im trying to rbind it. so it shouldnt matter. I do not know where the NA's will come. But if you think there will be NA's, I can have the NAs. I do not want to ignore any of the data – user3554354 Mar 27 '15 at 23:55
  • You need to change the second column name in each data frame so they match. If you named it `value` for example then `rbind` would work. – jraab Mar 28 '15 at 00:57
  • Closed to put this question "out of its misery." – IRTFM Mar 28 '15 at 01:06

0 Answers0