Skip to content

Add groupindices as special source argument in minilanguage #2683

@jkrumbiegel

Description

@jkrumbiegel

I often want to know a group's index in transform statements, especially when I have sorted while grouping and need to continue doing something with this order. There is currently no easy way to access the group indices.

data.table has the special variable .GRP for this purpose. There's also .NGRP which returns the number of groups, which could also be useful.

I'm thinking that one could elevate groupindices to the same status as nrow so that one can write this:

transform(groupdf, groupindices => do_something_with_the_indices)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions