Yeah I realized that myself. <div><br></div><div>Another one: the function "with" doesn't seem to do what I want... but at least it is consistent!<br><br><div class="gmail_quote">2011/7/20 Timothée Carayol <span dir="ltr"><<a href="mailto:timothee.carayol@gmail.com">timothee.carayol@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font face="courier new,monospace">Sorry -- </font><div><font face="courier new,monospace"><br></font></div><div><font face="courier new,monospace">subset() was a poor idea, as it will return a data.frame even if the argument is a data.table..<br>
</font></div><div><div></div><div class="h5"><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"><br>
</font><div class="gmail_quote">2011/7/20 Timothée Carayol <span dir="ltr"><<a href="mailto:timothee.carayol@gmail.com" target="_blank">timothee.carayol@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font face="courier new,monospace"><div><font face="courier new,monospace">Hi--</font></div><div><font face="courier new,monospace"><br></font></div></font><font face="courier new,monospace">You can use the subset() command with the select= option; not sure it's the best solution, though.<br>
</font><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">Timothee<br></font></div><div><div class="gmail_quote">
<br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><div><div></div><div>On Wed, Jul 20, 2011 at 12:26 PM, Chris Neff <span dir="ltr"><<a href="mailto:caneff@gmail.com" target="_blank">caneff@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>
I have a function where I pass a data frame and some variable names to calculate statistics on. However, I am at a loss as to how to write it correctly so that both data.frame and data.table work with it. If I have:<div>
<br>
</div><div>DF = data.frame(x=1:10,y=2:11,z=3:12)</div><div><br></div><div>DT = data.table(DF)</div><div><br></div><div>var.names = c("x","y")</div><div><br></div><div><br></div><div>I can do the following things to subset:</div>
<div><br></div><div>DT[,var.names,with=FALSE]</div><div>DF[,var.names]</div><div><br></div><div><br></div><div>but of course DT[,var.names] won't give me back what I want, and DF[,var.names,with=FALSE] returns an error because with doesn't exist there. So how do I do this?</div>
<div><br></div><div>Thanks,</div><div>-Chris</div><font color="#888888"><div><br></div><div><br></div>
</font><br></div></div>_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>