[R] names error message

William Dunlap wdunlap at tibco.com
Tue Dec 3 00:47:42 CET 2013


> I ran a job to combine 2 dataframes using rbind.
> I received this error message that the names were not the same
> Error in match.names(clabs,names(xi)): names do not match previous names

The column names of the data.frames given to rbind must all be
permutations of one another.   E.g.,
    > rbind(data.frame(A=1:3,B=11:13), data.frame(B=14:17, A=4:7))
      A  B
    1 1 11
    2 2 12
    3 3 13
    4 4 14
    5 5 15
    6 6 16
    7 7 17
but not
    > rbind(data.frame(A=1:3,B=11:13), data.frame(B=14:17, C=104:107))
    Error in match.names(clabs, names(xi)) : 
      names do not match previous names

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of Julie Royster
> Sent: Monday, December 02, 2013 12:39 PM
> To: r-help at r-project.org
> Subject: [R] names error message
> 
> Hello wise R folks,
> 
> I ran a job to combine 2 dataframes using rbind.
> I received this error message that the names were not the same
> 
> Error in match.names(clabs,names(xi)): names do not match previous names
> 
> BUT when I entered this statement
> 
> Identical (names(data1[[1]]),names(data2[[2]]) )
> 
> R responded TRUE to this query, indicating the names are identical
> 
> So I am baffled.  visually checking each dataset using str they look the
> same, and R says they are the same when queried,
> But I still get the error when I give this command
> 
> newname <- rbind (data1,data2)
> 
> Any ideas?
> THANKS!
> Julie
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list