Code to reproduce the problem:
data(iris)
L=list(data=iris)
print(deparse(substitute(L[[1]])))
[1] "L[[1]]"
I want the result to be "iris" instead of "L[[1]]", is there a way?
Code to reproduce the problem:
data(iris)
L=list(data=iris)
print(deparse(substitute(L[[1]])))
[1] "L[[1]]"
I want the result to be "iris" instead of "L[[1]]", is there a way?
L <- list(data=as.name("iris"))
L$data
And to actually retrieve the data:
eval(L$data)
But what you should be doing, rather than playing around with eval
and deparse
, is storing the name of the dataset along with its contents:
L <- list(iris=iris)
names(L)
L