[datatable-help] Fail to add new columns within a function

Huashan Chen chenhuashan at gmail.com
Sat Dec 14 02:30:54 CET 2013


I just found out that when the column quota are reached, adding new columns
within a function will fail.

Blow are the testing code:

testF2=function(x){  
  add_var<-function(varname){
    x[, `:=`(eval(substitute(varname)), 1), with=F]  
  }
  sapply(paste0('a', 1:101), add_var)
}

dd=data.table(a=1:3)
truelength(dd)
testF2(dd)
dim(dd)   # only 100 columns

dd[, new:=3]
dim(dd)  # adding new column outside a function is OK.



--
View this message in context: http://r.789695.n4.nabble.com/Fail-to-add-new-columns-within-a-function-tp4682173.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list