[datatable-help] .I does not respect by

Gabor Grothendieck ggrothendieck at gmail.com
Tue Apr 1 14:02:10 CEST 2014


Perhaps it could read .I = 1:nrow(x).  Note that .I does not equal
1:.N if there are groups.


On Tue, Apr 1, 2014 at 7:57 AM, Arunkumar Srinivasan
<aragorn168b at gmail.com> wrote:
> The key part is "row locations in x". If it were to reset for each group,
> then that part wouldn't have been necessary.
> Perhaps it'd be clearer if it were something like this: ".I is an integer
> vector which, for each group, holds the corresponding row numbers in/from/of
> x"? Not sure which preposition is most appropriate here.
>
> Arun
>
> From: Gabor Grothendieck ggrothendieck at gmail.com
> Reply: Gabor Grothendieck ggrothendieck at gmail.com
> Date: April 1, 2014 at 1:45:39 PM
> To: Arunkumar Srinivasan aragorn168b at gmail.com
> Cc: datatable-help at lists.r-forge.r-project.org
> datatable-help at lists.r-forge.r-project.org
> Subject:  Re: [datatable-help] .I does not respect by
>
> From the documentation I would have expected that the row locations
> start over at 1 for each group so that .I = 1:.N. but these are not
> equivalent.
>
> On Tue, Apr 1, 2014 at 7:20 AM, Arunkumar Srinivasan
> <aragorn168b at gmail.com> wrote:
>> Gabor,
>>
>> It's the same as in 1.8.10 and 1.9.2. What is contradicting in
>> ?data.table?
>> It says under .I: ".I is an integer vector length .N holding the row
>> locations in x for this group."
>>
>> The row locations in x for b=1,2,1,2 are 1,2,3,4 which then becomes 1,3
>> and
>> 2,4 for this group => b=1 and b=2 respectively.
>>
>>
>> Arun
>>
>> From: Gabor Grothendieck ggrothendieck at gmail.com
>> Reply: Gabor Grothendieck ggrothendieck at gmail.com
>> Date: April 1, 2014 at 1:09:23 PM
>> To: datatable-help at lists.r-forge.r-project.org
>> datatable-help at lists.r-forge.r-project.org
>> Subject: [datatable-help] .I does not respect by
>>
>> In the following .I seems not to be within group.
>>
>>> dt <- data.table(a = 1:4, b = 1:2)
>>> dt[, .I, by = b]
>> b .I
>> 1: 1 1
>> 2: 1 3
>> 3: 2 2
>> 4: 2 4
>>> packageVersion("data.table")
>> [1] '1.9.3'
>>
>> This seems contrary to ?data.table.
>>
>>
>> --
>> Statistics & Software Consulting
>> GKX Group, GKX Associates Inc.
>> tel: 1-877-GKX-GROUP
>> email: ggrothendieck at gmail.com
>> _______________________________________________
>> 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
>
>
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com



-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com


More information about the datatable-help mailing list