[datatable-help] rbind behavior

Matthew Dowle mdowle at mdowle.plus.com
Mon Oct 24 02:08:31 CEST 2011


Ah. Then I think that was deliberate at the time. I sometimes mislabel
column names and want R to warn me rather than doing silent cross-ref.
Other times I just think in terms of column order and am not too
concerned with the names. I don't mind changing it to do cross ref for
consistency but would like to keep the warning. Views?

On Sun, 2011-10-23 at 14:35 -0400, Steve Lianoglou wrote:
> I think he means that running data.frame.rbind on these:
> 
> R> d1 <- data.frame(a=1:10, b=11:20)
> R> d2 <- data.frame(b=101:120, a=21:30)
> R> rbind(d1, d2)
> 
> Will "cross ref" the "a" and "b" columns and stack them correctly on
> top of each other.
> 
> Doing the same with two data.table will bind the two together, but
> won't do the cross-ref. It just gives you a warning that the names
> didn't match, but rbind's the first to the first, and the second to
> the second (columns) anyway.
> 
> -steve
> 
> On Sun, Oct 23, 2011 at 2:19 PM, Matthew Dowle <mdowle at mdowle.plus.com> wrote:
> > Hi. Not sure what you mean, example needed please. Is that with v1.7.1 now
> > on CRAN? There has been some to and fro on chind/rbind in last few
> > versions.
> >
> >> Hi Matthew,
> >>
> >> Not sure if this is planned or inadvertent, but rbind matches up named
> >> columns with data.frames but doesn't with data.table (data.table does give
> >> the friendly warning).
> >>
> >> Thanks as always for your excellent package,
> >>
> >> Damian
> >>
> >>
> >> _______________________________________________
> >> datatable-help mailing list
> >> datatable-help at lists.r-forge.r-project.org
> >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
> >
> >
> > _______________________________________________
> > datatable-help mailing list
> > datatable-help at lists.r-forge.r-project.org
> > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
> >
> 
> 
> 




More information about the datatable-help mailing list