Skip to content

eval(, envir=.SD) no longer working #880

@tyner

Description

@tyner

We used to be able to do (in version 1.8.10), things like:

DT <- as.data.table(iris)
DT$foo <- "Species"
DT[,bar:=eval(parse(text=foo[1]), envir=.SD)]

but now (in version 1.9.4) it gives:

Error in parse(text = foo[1]) : object 'foo' not found

I'm wondering if this is expected, and if so, what is the recommended workaround?

Thanks
Ben

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions