:= should still suppress print if i is logical and all FALSE #887

Closed
JBreidaks opened this Issue Oct 14, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@JBreidaks

In package data.table version 1.9.5 when I check if the variable is within the specified limits, but any value of variable don't exist and print out all data.table.

Example:
Package data.table version 1.9.5:

library(data.table)
d <- data.table(a=c("A2","A4","A2"))
d[, sert:=""]
d[a %in% c("BE", "BD"), sert:="11"]
a sert
1: A2
2: A4
3: A2

str(d)
Classes ‘data.table’ and 'data.frame': 3 obs. of 2 variables:
$ a : chr "A2" "A4" "A2"
$ sert: chr "" "" ""

  • attr(*, ".internal.selfref")=
  • attr(, "index")= atomic
    ..- attr(
    , "__a")= int 1 3 2
@jangorecki

This comment has been minimized.

Show comment
Hide comment
@jangorecki

jangorecki Oct 14, 2014

Member

looks like a bug.
I did notice the issue did not occurs on binary search (at least in 1.9.4):

setkey(d,a)
d[.(c("BE", "BD")), sert:="11"]

you might try to rewrite your code to binary search as it will also improve the performance

Member

jangorecki commented Oct 14, 2014

looks like a bug.
I did notice the issue did not occurs on binary search (at least in 1.9.4):

setkey(d,a)
d[.(c("BE", "BD")), sert:="11"]

you might try to rewrite your code to binary search as it will also improve the performance

@mattdowle mattdowle added this to the v1.9.6 milestone Oct 14, 2014

@mattdowle mattdowle changed the title from Print out data.table within the specified limits without any element to := should still suppress print if i is logical and all FALSE Oct 14, 2014

@mattdowle

This comment has been minimized.

Show comment
Hide comment
@mattdowle

mattdowle Oct 14, 2014

Member

Thanks. Agreed it's a printing issue (data looks correct) ... will fix.
@jangorecki Re rewriting to use binary search ... new feature auto indexing means it's now ok to use == and %in% and those will now either use any existing physical key (an earlier setkey) or create a secondary key (set2key) automatically and then use it. For just one == (or %in%) in i, currently.

Member

mattdowle commented Oct 14, 2014

Thanks. Agreed it's a printing issue (data looks correct) ... will fix.
@jangorecki Re rewriting to use binary search ... new feature auto indexing means it's now ok to use == and %in% and those will now either use any existing physical key (an earlier setkey) or create a secondary key (set2key) automatically and then use it. For just one == (or %in%) in i, currently.

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