given callbelow
why eval(call)gives results other than just typing the expression directly into the console
x <- list(Vect=seq(3), Mat=matrix(seq(9), ncol=3))
theCall <- as.call(c(expression(data.frame), x))
theCall
data.frame(Vect=1:3, Mat=1:9)
eval(theCall)
eval(parse(text=capture.output(theCall)))
I even tried calling eval on the dput of an expression that converts to a call, and still cannot get the same results as eval (theCall)
dput(c(expression(data.frame), x))
# structure(expression(data.frame, Vect = 1:3, Mat = 1:9), .Names = c("", "Vect", "Mat"))
eval(as.call(structure(expression(data.frame, Vect = 1:3, Mat = 1:9), .Names = c("", "Vect", "Mat"))))
# Vect Mat
# 1 1 1
# 2 2 2
# 3 3 3
# 4 1 4
# 5 2 5
# 6 3 6
# 7 1 7
# 8 2 8
# 9 3 9
source
share