Rdatatable / Rdatatable/data.table

[R-Forge #2763] Reduce NAMED(2) RHS

Open
#573 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request internals
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

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.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.