[Request] Verbose message "Assigning to .N row subset of .N rows" seems wrong when x[i] is empty #1808

Closed
franknarf1 opened this Issue Aug 11, 2016 · 0 comments

Comments

Projects
None yet
3 participants
@franknarf1

I was looking at...

library(data.table)
DT = data.table(a = 1:10)

DT[a < 5, a := 5L, verbose=TRUE]
# Detected that j uses these columns: a 
# Assigning to 4 row subset of 10 rows

DT[a < 5, a := 5L, verbose=TRUE]
# Detected that j uses these columns: a 
# Assigning to 10 row subset of 10 rows

In the second instance, there is (I reckon) no assignment taking place, so it shouldn't look like all rows were modified. Similarly...

DT[0, d := 1, verbose=TRUE]
# Detected that j uses these columns: <none> 
# Assigning to 1 row subset of 10 rows

Here, I would expect to see numbers that better reflect what happened: d was initialized to NA on all rows. Ditto for DT[.(a=11L), on="a", f := 1, verbose=TRUE].

I'm interested in this because my colleagues are coming to R from Stata, which has this sort of feature (reporting counts of rows modified). I don't know if this should be characterized as a FR or bug.

@mattdowle mattdowle added this to the v1.9.8 milestone Oct 15, 2016

@mattdowle mattdowle closed this in 8c9cfc8 Oct 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment