Rdatatable / Rdatatable/data.table
[R-Forge #2763] Reduce NAMED(2) RHS
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 3.9k
- Forks
- 1.1k
- Avg merge
- 14h 4m
- Merged PRs (30d)
- 4
Description
Submitted by: Matt Dowle; Assigned to: Nobody; R-Forge link
Seems like an extra step at C level might be bumping to NAM(2) unnecessarily.
As raised by Frank in comments here :
http://stackoverflow.com/a/16152670/403310
Consider :
options(datatable.verbose = TRUE)
a = 1:3
b = 4:6
DT = data.table(DUMMYCOL=1:3)
.Internal(inspect(DT[,ifelse(!is.na(a),a,b)]))
Detected that j uses these columns:
@0x00000000080a5780 13 INTSXP g0c2 [NAM(2)](len=3, tl=0) 1,2,3
DT[,foo:=ifelse(!is.na(a),a,b)]
Detected that j uses these columns:
Assigning to all 3 rows
RHS for item 1 has been duplicated. Either NAMED vector or recycled list RHS.
DT
DUMMYCOL foo
1: 1 1
2: 2 2
3: 3 3
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 with the R-Forge report and its reproduced DT[,ifelse(...)] and DT[,foo:=...] examples. Inspect the C-level RHS assignment path involved by the second example, using the supplied verbose output and internal inspection to verify where NAM(2) or duplication is introduced. Done means the unnecessary duplication is removed while both examples retain their shown results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, r
- Domain
- data, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100