<div>Hi Huashan,</div><div>
                    Great reproducible example! Would you mind filing a bug report <a href="https://r-forge.r-project.org/tracker/?func=browse&group_id=240&atid=975">here</a>?</div>
                <div><div>Thank you,</div><div>Arun</div><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Saturday, December 14, 2013 at 2:30 AM, Huashan Chen wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>I just found out that when the column quota are reached, adding new columns</div><div>within a function will fail.</div><div><br></div><div>Blow are the testing code:</div><div><br></div><div>testF2=function(x){  </div><div>  add_var<-function(varname){</div><div>    x[, `:=`(eval(substitute(varname)), 1), with=F]  </div><div>  }</div><div>  sapply(paste0('a', 1:101), add_var)</div><div>}</div><div><br></div><div>dd=data.table(a=1:3)</div><div>truelength(dd)</div><div>testF2(dd)</div><div>dim(dd)   # only 100 columns</div><div><br></div><div>dd[, new:=3]</div><div>dim(dd)  # adding new column outside a function is OK.</div><div><br></div><div><br></div><div><br></div><div>--</div><div>View this message in context: <a href="http://r.789695.n4.nabble.com/Fail-to-add-new-columns-within-a-function-tp4682173.html">http://r.789695.n4.nabble.com/Fail-to-add-new-columns-within-a-function-tp4682173.html</a></div><div>Sent from the datatable-help mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.</div><div>_______________________________________________</div><div>datatable-help mailing list</div><div><a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a></div><div><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>