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

ALTREP error with `unique()` #3051

Closed
mllg opened this issue Sep 18, 2018 · 3 comments
Labels
bug
Milestone

Comments

@mllg
Copy link
Contributor

@mllg mllg commented Sep 18, 2018

Minimal reproducible example

x = as.data.table(iris)
x[["foo"]] = 1:150
unique(x, by = "Species")

This yields:

Internal error in subset.c: column 6 is an ALTREP vector. Please see NEWS item 2 in v1.11.4 and report this as a bug.

Tested with v11.4 and latest dev version.

Output of sessionInfo()

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/de_DE.UTF-8/en_US.UTF-8/C/en_US.UTF-8/de_DE.UTF-8

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

other attached packages:
[1] nvimcom_0.9-75    gtfo_0.0.0.9000   devtools_1.13.6   data.table_1.11.5

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1    parallel_3.5.1 withr_2.1.2    memoise_1.1.0  digest_0.6.17 
@HughParsonage HughParsonage added the bug label Sep 19, 2018
@DavidArenburg

This comment has been minimized.

Copy link
Member

@DavidArenburg DavidArenburg commented Sep 20, 2018

That an awkward one, but as temporary fix, I would use the idiomatic data.table syntax which doesn't produce an error, e.g. x[, foo := 1:150] ; unique(x, by = "Species")

@petersteiner

This comment has been minimized.

Copy link

@petersteiner petersteiner commented Sep 28, 2018

I have found a simple fix for all of these "ALTREP error" issues. You can do the following:
x <- copy(x) and unique(x, by="Species") will work.

@MichaelChirico

This comment has been minimized.

Copy link
Member

@MichaelChirico MichaelChirico commented Sep 28, 2018

@petersteiner that may work in a bind but it's not really recommended. What if you have a 15Gb data set and only 20Gb RAM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.