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

Under-allocation of truelength after subsetting #3228

Closed
renkun-ken opened this issue Dec 15, 2018 · 1 comment
Closed

Under-allocation of truelength after subsetting #3228

renkun-ken opened this issue Dec 15, 2018 · 1 comment
Labels
Milestone

Comments

@renkun-ken
Copy link
Member

The allocation behavior seems to be changed. The truelength() is largely reduced after any subsetting. Massive adding columns to the under-allocated data.table in other environment would fail to apply to the original object.

library(data.table)

dt <- data.table(id = 1:1000)
dt[, x := rnorm(.N)]
truelength(dt)
#> [1] 1025

dt1 <- dt[x > 0]
truelength(dt1)
#> [1] 66
@mattdowle
Copy link
Member

Thanks. I see the issue. CsubsetDT does the over-allocation inside it at C level. It needs the alloc.col option passing down from R level. Will do.

@mattdowle mattdowle added this to the 1.12.0 milestone Dec 15, 2018
@mattdowle mattdowle added the dev label Dec 15, 2018
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

2 participants