perhaps you can use length() == 0 instead of is.null() for your purposes
On Tue, Oct 29, 2013 at 1:01 PM, Eduard Antonyan <[email protected]>wrote: > This is by design, and is not a bug. > > If you try > > data.table:::.rbind.data.table(NULL, NULL) > > in version 1.8.10 you will also get a 0-size data.table in agreement with > rbindlist (if you try the above in the very latest version, you will get an > error, and I may change that to be same as 1.8.10 - but it doesn't matter > much, as you can't get there unless you use ":::", and then all bets are > off anyway). Both are supposed to always return data.tables. > > The reason you're getting something else with rbind(NULL, NULL) is because > those NULL's are not data.tables, so a *different* rbind is called, which > has nothing to do with data.table. > > > > On Tue, Oct 29, 2013 at 12:47 PM, Chris Neff <[email protected]> wrote: > >> Simple thing: >> >> dt <- rbindlist(list(NULL, NULL)) #dt is a data.table with 0 rows and >> columns >> >> is.null(dt) # Prints false >> >> d <- rbind(NULL, NULL) #d is NULL >> >> is.null(d) # Prints true >> >> >> I would expect the two to be equivalent. This bit me when I was relying >> on !is.null(dt) before assigning other columns in the data.table. >> rbindlist should return NULL in this case I would think. >> >> Is this working as intended? Or should I file a bug? >> >> _______________________________________________ >> datatable-help mailing list >> [email protected] >> >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help >> > >
_______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
