rolling join with a new twist, the mult=unique
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with the A and B toy examples in the issue and compare the proposed mult="unique" result with the current rolling join and row-by-row workaround. Define the behavior for unique matching and tolerance, including how unmatched rows are represented; the issue names no source files or tests, so repository-wide join implementation and test discovery will be needed.
Written by the indexing model from the issue text.
Description
Hello data.table team,
Consider the toy example. I have two tables A and B defined as follows:
> A <- data.table(a=c(1.2,3.4), c1=c(1,2))
> A
a c1
1: 1.2 1
2: 3.4 2
> B <- data.table(a=c(1.3,3.4,3.5), c2=c(3,4,5))
> B
a c2
1: 1.3 3
2: 3.4 4
3: 3.5 5
Now a new feature of join would allow us to do this:
> A[B,by="a",roll=1,mult="unique"]
a c1 c2
1: 1.3 1 3
2: 3.4 2 4
3: 3.5 NA 5
Note that a conventional rolling join would result in something different:
> A[B,on="a",roll=1]
a c1 c2
1: 1.3 1 3
2: 3.4 2 4
3: 3.5 2 5
Unfortunately the toy example does not illustrate the usefulness of this feature very well. Consider this: I have two tables from two different sources with slightly different time stamps and some missing data. This feature would allow me to match them up row-by-row (with a specified tolerance) and identify the missing rows in one of the sources.
The most straightforward way to produce the desired result with the current version of data.table is to join A to B one row at a time (in a loop) and to discard the row that was joined from A (if there was one). The proposal above would make this a snap.
- Dominant language
- R
- Stars
- 3.9k
- Forks
- 1.1k
- Avg merge
- 14h 4m
- Merged PRs (30d)
- 4
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.
More from Rdatatable/data.table
-
as.data.table() recurses without end on a survival::Surv object (or any data.frame carrying one) Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Rdatatable/data.table#7887 ·
-
consistency tests
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Rdatatable/data.table#7853 · 3 comments ·
-
internals
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Rdatatable/data.table#6938 · 1 comment ·
-
encoding fread
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Rdatatable/data.table#5179 · 8 comments ·
-
documentation programming
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Rdatatable/data.table#3199 · 3 comments ·
All issues in Rdatatable/data.table
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enviPathR OpenBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Bioconductor/BiocContributions#207 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
datacarpentry/semester-biology#1255 ·