[datatable-help] rbind empty data tables

Matthew Dowle mdowle at mdowle.plus.com
Tue Oct 1 12:23:51 CEST 2013


Interesting, thanks for reporting. I've filed as bug #4959

https://r-forge.r-project.org/tracker/?group_id=240&atid=975&func=detail&aid=4959

Matt

On 30/09/13 21:06, Alexandre Sieira wrote:
> By the way, this works as I would expect with data.frame on the same 
> environment:
>
> > df1 = data.frame(a=character())
> > df2 = data.frame(a=character())
> > df1
> [1] a
> <0 rows> (or row.names with length 0)
> > df2
> [1] a
> <0 rows> (or row.names with length 0)
> > rbind(df1, df2)
> [1] a
> <0 rows> (or row.names with length 0)
>
> -- 
> Alexandre Sieira
> CISA, CISSP, ISO 27001 Lead Auditor
>
> "The truth is rarely pure and never simple."
> Oscar Wilde, The Importance of Being Earnest, 1895, Act I
>
> On 30 de setembro de 2013 at 13:01:47, Alexandre Sieira 
> (alexandre.sieira at gmail.com) wrote:
>
>> I encountered the following behavior with data.table 1.8.10 on R 
>> 3.0.2 on Mac OS X and was wondering if that is expected:
>>
>> > dt1 = data.table(a=character())
>> > dt2 = data.table(a=character())
>> > dt1
>> Empty data.table (0 rows) of 1 col: a
>> > colnames(dt1)
>> [1] "a"
>> > dt2
>> Empty data.table (0 rows) of 1 col: a
>> > colnames(dt2)
>> [1] "a"
>> > rbind(dt1, dt2)
>> Error in setnames(ret, nm.original) : x has no column names
>>
>> Enter a frame number, or 0 to exit
>>
>> 1: rbind(dt1, dt2)
>> 2: rbind(deparse.level, ...)
>> 3: data.table::.rbind.data.table(...)
>> 4: setnames(ret, nm.original)
>>
>> If I rbind two zero-row data.table objects with matching column 
>> names, I would have expected to get a zero-row data.table back (0 + 0 
>> = 0, after all).
>>
>> -- 
>> Alexandre Sieira
>> CISA, CISSP, ISO 27001 Lead Auditor
>>
>> "The truth is rarely pure and never simple."
>> Oscar Wilde, The Importance of Being Earnest, 1895, Act I
>
>
> _______________________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20131001/afd9d0a2/attachment.html>


More information about the datatable-help mailing list