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

lhs field is not being found after `:=` assignement. #2338

Closed
ProfFancyPants opened this issue Sep 7, 2017 · 4 comments
Closed

lhs field is not being found after `:=` assignement. #2338

ProfFancyPants opened this issue Sep 7, 2017 · 4 comments
Milestone

Comments

@ProfFancyPants
Copy link

@ProfFancyPants ProfFancyPants commented Sep 7, 2017

Is this new behavior intended? I am getting an error when assigning imx in the first example.

DT <- data.table(LETTERS, letters)
DT[, imx := .I]
f_det_blk <- function(x) {!all(is.na(x))}
DT[,   imx := ifelse(apply(.SD, 1, f_det_blk), imx, imx * -1L), .SDc = !'imx'] #error
DT[, ('imx') := ifelse(apply(.SD, 1, f_det_blk), imx, imx * -1L), .SDc = !'imx'] #no error

Is this the new intended behavior?

System info

library(data.table)
data.table 1.10.5 IN DEVELOPMENT built 2017-09-07 14:48:23 UTC; appveyor

data.table::test.data.table()
Running test id 168 Don't know how to automatically pick scale for object of type ITime. Defaulting to continuous.
Don't know how to automatically pick scale for object of type ITime. Defaulting to continuous.
Running test id 1372.2 Tests 1372.3+ not run. If required call library(GenomicRanges) first.
Running test id 1383.3 Tests 1383.4 not run. If required call library(caret) first.
Running test id 1751 Test 1752 not run. If required call library(nanotime) first.
Running test id 1823.3
endian==little, sizeof(long double)==16, sizeof(pointer)==8
All 6010 tests in inst/tests/tests.Rraw completed ok in 00:02:05 on Thu Sep 07 13:04:13 2017

sessionInfo()
R Under development (unstable) (2017-09-06 r73210)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] rmarkdown_1.6 curl_2.8.1 gdata_2.18.0 xts_0.10-0 zoo_1.8-0 nlme_3.1-131
[7] fastmatch_1.1-0 hexbin_1.27.1 testthat_1.0.2 plyr_1.8.4 ggplot2_2.2.1 chron_2.3-50
[13] knitr_1.17 bit64_0.9-7 bit_1.1-12 data.table_1.10.5 reshape2_1.4.2 reshape_0.8.7

loaded via a namespace (and not attached):
[1] Rcpp_0.12.12 highr_0.6 compiler_3.5.0 tools_3.5.0 digest_0.6.12 evaluate_0.10.1
[7] tibble_1.3.4 gtable_0.2.0 lattice_0.20-35 rlang_0.1.2 yaml_2.1.14 stringr_1.2.0.9000
[13] gtools_3.5.0 rprojroot_1.2 grid_3.5.0 R6_2.2.2 magrittr_1.5 scales_0.5.0
[19] backports_1.1.0 htmltools_0.3.6 colorspace_1.3-2 labeling_0.3 stringi_1.1.6 lazyeval_0.2.0
[25] munsell_0.4.3 crayon_1.3.2

rstudioapi::versionInfo()
$mode [1] "desktop"
$version [1] ‘1.1.359’

@MichaelChirico

This comment has been minimized.

Copy link
Member

@MichaelChirico MichaelChirico commented Sep 7, 2017

Perhaps introduced by #2329 ?

Can you try installing a version of data.table from about a week ago (or even the CRAN version) and confirming the bug is new?

Pinging @renkun-ken in case he sees what's going wrong.

@franknarf1

This comment has been minimized.

Copy link
Contributor

@franknarf1 franknarf1 commented Sep 7, 2017

@MichaelChirico Fwiw, it does work with CRAN (with this simpler example):

# 1.10.4
data.table(x=1, y=1)[, x := {.SD; x + 1}, .SDcols = "y"][]
#    x y
# 1: 2 1

# current dev (built 2017-09-06 22:02:57 UTC; travis)
data.table(x=1, y=1)[, x := {.SD; x + 1}, .SDcols = "y"][]
# Error in eval(expr, envir, enclos) : object 'x' not found
@renkun-ken

This comment has been minimized.

Copy link
Member

@renkun-ken renkun-ken commented Sep 8, 2017

Yes, it is indeed introduced by #2329 which attempts to address #2326. It seems a bit tricky to resolve both. Need to take a closer look at this.

@MichaelChirico

This comment has been minimized.

Copy link
Member

@MichaelChirico MichaelChirico commented Sep 8, 2017

Either way, this case seems to have been missed by the test suite.

renkun-ken added a commit to renkun-ken/data.table that referenced this issue Sep 8, 2017
renkun-ken added a commit to renkun-ken/data.table that referenced this issue Sep 8, 2017
@mattdowle mattdowle added this to the v1.10.6 milestone Sep 8, 2017
mattdowle added a commit that referenced this issue Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.