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

mget doesn't find columns (without specifying the environment explicitly) #994

Closed
ecoRoland opened this issue Jan 1, 2015 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@ecoRoland
Copy link

DT <- data.table(a=1:2, b=c("x", "y")) 
DT[, get("a")] 
#[1] 1 2 
DT[, mget("a", inherits = TRUE)] 
#Error: value for ‘a’ not found

It works if the correct environment is specified:

DT[, mget("a", as.environment(.SD))] 
#   a
#1: 1
#2: 2

According to Arun:

The j-exp is parsed and checked for get(), but not mget(). Therefore the SD environment isn't constructed with the required columns.

@arunsrinivasan arunsrinivasan self-assigned this Jan 3, 2015
@arunsrinivasan arunsrinivasan added this to the v1.9.6 milestone Jan 3, 2015
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