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 ([email protected]) 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
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to