Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-Forge #2445] := fails when subsetting yields NAs and with=FALSE #166

Closed
arunsrinivasan opened this issue Jun 8, 2014 · 0 comments
Closed
Labels

Comments

@arunsrinivasan
Copy link
Member

Submitted by: Damian Betebenner; Assigned to: Arun ; R-Forge link

Consider the following situation:

for (tmp.merge.variable in variables.to.merge) {

slot.data[tmp.data[,key(slot.data), with=FALSE], tmp.merge.variable := tmp.data[[tmp.merge.variable]], with=FALSE, mult="first"]

}

When the join of tmp.data[,key(slot.data),with=FALSE] to slot.data has some NA in the result we get the error (sometimes)

"Error during wrapup: Internal error: NA exist in 'rows' passed to C assign"

When with=TRUE and there are NAs it works ok, but not always when with=FALSE.


Still a problem in latest v1.8.11 :

X = data.table(A=1:3,B=1:6,key="A")
X
A B
1: 1 1
2: 1 4
3: 2 2
4: 2 5
5: 3 3
6: 3 6
X[J(2:5),B:=21L] # Ok. NB: values 4 and 5 join missing, but this is fine.
var = "B"
X[J(2:5),var:=22L,with=FALSE] # should work as well
Error in [.data.table(X, J(2:5), :=(var, 21L), with = FALSE) :
i[5] is NA. Can't assign by reference to row 'NA'.
X[J(2:5),(var):=22L] # but this is ok and good
X
A B
1: 1 1
2: 1 4
3: 2 22
4: 2 22
5: 3 22
6: 3 22

mattdowle added a commit that referenced this issue Sep 29, 2016
…Col==3] where DT is one row and someCol is NA, returns no rows for consistency with nrow>1 cases.  with=FALSE with := now warns.  nomatch with := now warns.  logical i no longer recycles unless length 1 or nrow. #1001 #1002 #759 #354 #166 and closes #1252.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant