Skip to content

bug in group_by #1093

Closed
Closed

Description

@sfischme

Try this:

            time type loc                             call     p cnt
1  1304945116000    a   b 1fb646244dbd6c807005811838b1e5ec 53115   0
2  1304945116000    a   b 6b3dafa1ff257c3891fc87abc78e137e     1   0
3  1304945116000    a   b 6e6f8c68c86173aa7e98b6375e752f89    NA   0
4  1304945116000    a   b d02922f7a545c15632c9ecb39e6da9a2    NA   0
5  1304945116000    a   b 11ce203ca480e56f03a7d1a9591de0e9    NA   0
6  1304945116000    a   b 7dabc9db21bbdc080780f493fe93f2af 53115   0
7  1304945116001    a   b 6b3dafa1ff257c3891fc87abc78e137e     1   1
8  1304945116001    a   b 6e6f8c68c86173aa7e98b6375e752f89    NA   1
9  1304945116001    a   b d02922f7a545c15632c9ecb39e6da9a2    NA   1
10 1304945116001    a   b 11ce203ca480e56f03a7d1a9591de0e9    NA   1

# now compare these two, they should be the same:
q.2 %>% group_by(time, type, loc, call) %>% summarize(n=n()) %>% filter(n>1)
q.2 %>% data.table() %>% group_by(time, type, loc, call) %>% summarize(n=n()) %>% filter(n>1)

Activity

  1. DavidArenburg commented on Mar 25, 2015

    @DavidArenburg
    Member

    groub_by is not data.table function...

  2. sfischme commented on Mar 25, 2015

    @sfischme
    Author

    You are right, this produces the expected output:

    q.2[,n:=nrow(.SD),by=list(time,type,loc,call)]
    
  3. eantonya commented on Mar 25, 2015

    @eantonya
    Contributor

    @sfischme simply use .N instead of nrow(.SD)

  4. arunsrinivasan commented on Mar 26, 2015

    @arunsrinivasan
    Member

    Convert time column to bit64::integer64 and try again. Or do setNumericRounding(0L) and try again. Read ?setNumericRounding to understand why we do this (including the examples). For large (integer) numbers, we recommend integer64.

    I'll add that we recommend bit4::integer64 to ?setNumericRounding and then close the issue.

  5. added this to the v1.9.6 milestone on Mar 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions