You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Submitted by: Michele Carriero; Assigned to: Arun ; R-Forge link
Given the following table dt:
dt<-data.table(id=1:5, var=letters[1:5])
If I need to retrieve programmatically a column I use eval(parse(text=variable)). But when the variable, containing (part of) the column name to retrieve, is also named alike another column in the table I have two different outcomes:
id<-"va"dt[, eval(parse(text=paste0(id,"r")))]
# [1] "a""b""c""d""e"dt[, id2:=eval(parse(text=paste0(id,"r")))]
# Error in parse(text = paste0(id, "r")) : <text>:1:2: unexpected symbol
1: 1r
^
I thought that the above was not intended to be so. I would expect the same result (probably the second).
The text was updated successfully, but these errors were encountered:
Submitted by: Michele Carriero; Assigned to: Arun ; R-Forge link
Given the following table dt:
If I need to retrieve programmatically a column I use
eval(parse(text=variable))
. But when the variable, containing (part of) the column name to retrieve, is also named alike another column in the table I have two different outcomes:I thought that the above was not intended to be so. I would expect the same result (probably the second).
The text was updated successfully, but these errors were encountered: