gwhich.max: GForce which min/max

Open
#7,678 3 comments 0 reactions 1 assignee View on GitHub

@ben-schwen is already working on this.

Since Apr 28, 2026.

Assessment

This issue has not been assessed yet.

Description

feature request GForce

Marked as TODO in https://github.com/Rdatatable/data.table/blob/7db13b99f6029d343f7127a8f7971bdf2e5fec0d/src/gsumm.c#L1021

I wonder if that could be used to optimize following queries "getting the latest version of data by group":

x[, .SD[timestamp_col == max(timestamp_col)], by = c(grouping_cols)]

base R which.max returns only first index, not all matching.

Considering above query returns 1+ rows for each group, it should be easier to implement now after having https://github.com/Rdatatable/data.table/pull/5089

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.