[datatable-help] rbind empty data tables
Alexandre Sieira
alexandre.sieira at gmail.com
Mon Sep 30 22:06:32 CEST 2013
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130930/2b4e71be/attachment-0001.html>
More information about the datatable-help
mailing list