[datatable-help] rbind empty data tables

Alexandre Sieira alexandre.sieira at gmail.com
Mon Sep 30 22:01:47 CEST 2013


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/051f8133/attachment.html>


More information about the datatable-help mailing list