[datatable-help] newbie question on logical column indexing

Steve Lianoglou mailinglist.honeypot at gmail.com
Sun Sep 23 22:58:24 CEST 2012


Hi,

This is now fixed in SVN,  revision 644:
https://r-forge.r-project.org/scm/viewvc.php?view=rev&root=datatable&revision=644

Thanks for the report, Mani!

-steve

On Sat, Sep 22, 2012 at 4:40 AM, Matthew Dowle <mdowle at mdowle.plus.com> wrote:
>
> Welcome.
>
> That's FR#1797 (Allow j to be logical when with=FALSE) :
> https://r-forge.r-project.org/tracker/index.php?func=detail&aid=1797&group_id=240&atid=978
>
> In the meantime can wrap with which().
>
>> Hi all,
>>   I am just starting to use data.table and finding it very convenient for
>> handling large datasets.
>>
>>   I am used to logical indexing of columns for wide data.frames, and
>> wondering why the same cannot be achieved with data.table even after
>> specifying with=FALSE.
>>
>> Here is a toy example.
>> ---
>> a = data.frame(x=1:3,y=4:6,z=7:9)
>> logidx = c(TRUE,TRUE,FALSE)
>> a[,logidx]
>> #   x y
>> # 1 1 4
>> # 2 2 5
>> # 3 3 6
>> a = data.table(a)
>> a[,c(1,2),with=FALSE] #works
>> a[,-3,with=FALSE] #works
>> a[,which(logidx),with=FALSE] #works
>> a[,logidx,with=FALSE] #doesn't work
>> # Error in `[.data.table`(a, , logidx, with = FALSE) : j out of bounds
>> ---
>>
>>   I'm trying to understand why the last command doesn't work? I'm using
>> data.table 1.8.2 and R 2.15.0. Any help is appreciated.
>>
>> Thanks,
>> Mani
>>
>> PS: Apologies if you receive multiple copies, as I was having trouble
>> subscribing to the email list.
>> _______________________________________________
>> 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



-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact


More information about the datatable-help mailing list