[datatable-help] `with=F` in the `i` Argument

Michael Smith my.r.help at gmail.com
Sun Jun 15 11:15:50 CEST 2014


Hi Arun,

Filed here:
https://github.com/Rdatatable/data.table/issues/696

Thanks,
M

On 06/15/2014 04:11 PM, Arunkumar Srinivasan wrote:
> Michael,
> 
> Thanks. Replacing |order| with |base:::order| seems to give the right
> result. So, I’d say this is a case that seem to have escaped current
> tests. So, yes, bug. Could you please file as one here
> <https://github.com/Rdatatable/data.table/issues>?
> 
> 
> Arun
> 
> From: Michael Smith my.r.help at gmail.com <mailto:my.r.help at gmail.com>
> Reply: Michael Smith my.r.help at gmail.com <mailto:my.r.help at gmail.com>
> Date: June 15, 2014 at 5:02:46 AM
> To: G See gsee000 at gmail.com <mailto:gsee000 at gmail.com>
> Cc: datatable-help at lists.r-forge.r-project.org
> datatable-help at lists.r-forge.r-project.org
> <mailto:datatable-help at lists.r-forge.r-project.org>
> Subject: Re: [datatable-help] `with=F` in the `i` Argument
> 
>> Devs,
>>
>> Is this a bug? It works in 1.9.2 but not in the 1.9.3 development
>> version:
>>
>> DT <- data.table(a = 1:4, b = 8:5)
>> for (i in c("a", "b"))
>> print(DT[order(DT[, i, with = FALSE])])
>>
>> Error in forder(DT, DT[, i, with = FALSE]) :
>> Column '1' is type 'list' which is not supported for ordering currently.
>>
>>
>> Thanks,
>>
>> M
>>
>>
>> On 05/31/2014 12:44 PM, G See wrote:
>> > Hi Michael,
>> >  
>> > I would use get()
>> >  
>> > DT <- data.table(a = 1:4, b = 8:5)
>> > for (i in c("a", "b"))
>> >   print(DT[order(get(i))])
>> >  
>> > For what it's worth, your solution doesn't seem to work in data.table
>> > 1.9.3 (svn rev. 1278):
>> >  
>> >> for (i in c("a", "b"))
>> > +   print(DT[order(DT[, i, with = FALSE])])
>> > Error in forder(DT, DT[, i, with = FALSE]) :
>> >   Column '1' is type 'list' which is not supported for ordering currently.
>> >  
>> >  
>> > HTH,
>> > Garrett
>> >  
>> > On Fri, May 30, 2014 at 11:01 PM, Michael Smith <my.r.help at gmail.com> wrote:
>> >> All,
>> >>
>> >> I'm trying to order the rows according to several columns at a time:
>> >>
>> >> DT <- data.table(a = 1:4, b = 8:5)
>> >> for (i in c("a", "b"))
>> >>   print(DT[order(i), with = FALSE])
>> >>
>> >> It doesn't work, since `with` seems to be about the `j` argument, but
>> >> not the `i` argument, according to `?data.table`.
>> >>
>> >> I found the following workaround, but wonder whether there is a more
>> >> elegant way to do it:
>> >>
>> >> for (i in c("a", "b"))
>> >>   print(DT[order(DT[, i, with = FALSE])])
>> >>
>> >> Thanks,
>> >> M
>> >> _______________________________________________
>> >> 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
>>
> 


More information about the datatable-help mailing list