[datatable-help] columns that show up when using both by-without-by and by=

Frank Erickson FErickson at psu.edu
Fri Jun 21 23:06:24 CEST 2013


Ok. Thanks, Arun. I could've sworn it did that already, but seeing as it
doesn't: yes, this is a feature request. :) --Frank


On Fri, Jun 21, 2013 at 4:01 PM, Arunkumar Srinivasan <aragorn168b at gmail.com
> wrote:

>  you can just do:
>
> > DT[J(letters[4:6]), list(v1=v1, 1),by=v3]
>
> If you use `by` only the columns in it will be included in the output. But
> it seems like what you request is a nicer feature and I am for it. Because,
> when you just do, DT[J(letters[4:6]), sum(v1)] it gives you "v1". But
> when using `by`, it disappears. I find with your suggestion this would be
> more consistent.
>
>
> Arun
>
> On Friday, June 21, 2013 at 10:26 PM, Frank Erickson wrote:
>
> Hi,
>
> I thought that when joining with J(x) and doing by=y, all the columns
> involved were put into .BY. However, I see that they are not:
>
> DT <- data.table(v1=letters[1:10],v2=1:10,v3=c(TRUE,FALSE),key="v1")
> DT[J(letters[4:6]),1,by=v3]
>
> I think I've just forgotten how to do this correctly (so that both v1 and
> v3 show up in the output). Any help would be appreciated.
>
> Thanks,
>
> Frank
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
>
>
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130621/4646f9f5/attachment.html>


More information about the datatable-help mailing list