Rdatatable / Rdatatable/data.table
Don't inspect i=CJ(...) names in DT[CJ(...), on=] joins
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 3.9k
- Forks
- 1.1k
- Avg merge
- 14h 4m
- Merged PRs (30d)
- 4
Description
Looking again at #1596 , one point against it is that some folks may be taking advantage of the default V1, V2, ... names, so auto-assigning different names would break their code.
One alternative, that would address my primary use-case, would be for CJ to not need names during a join:
library(data.table)
DT = unique(data.table(datasets::CO2)[, .(Plant, Type, Treatment)])
setkey(DT, Plant, Type)
# good -- no names needed using list
DT[.("Mc1", "Mississippi"), .N, by=.EACHI]
# good -- no names needed using CJ and (implicitly) on = key
DT[CJ(Plant, Type, unique=TRUE), .N, by = .EACHI]
# bad -- breaks for explicit on = key
DT[CJ(Plant, Type, unique=TRUE), on=key(DT)]
# bad -- breaks for on=some-non-key
DT[CJ(Plant, Treatment, unique = TRUE), on=.(Plant, Treatment)]
So I guess I'm asking for an exception in [.data.table that ignores names in i when i=CJ(...), similar to how names are ignored with list inputs or when on= is implicitly the key.
Of course, my desired syntax would also work if FR #1596 went through.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the [.data.table entry point and compare the CJ(...) cases shown for implicit keys, explicit keys, and non-key joins. Done means names from i=CJ(...) no longer break these joins while existing default V1, V2, ... names continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100