[R] how to get a value from a list (using paste function)?
Soyeon Kim
yunni0731 at gmail.com
Tue Dec 18 18:34:43 CET 2012
Dear my R friends,
I want to get a number from a list using paste function.
In my example,
lambda.rule <- "lambda.1se"
cvtest is a list (result from cv.glmnet)
and
cvtest$lambda.1se
[1] 1.308973
I want to call the value using paste function.
I used get function but there was an error.
test <- get(paste("cvtest$",lambda.rule, sep=""))
Error in get(paste("cvtest$", lambda.rule, sep = "")) :
object 'cvtest$lambda.1se' not found
Do you guys know how to solve this issue?
Thank you so much in advance and merry Christmas!
Soyeon
More information about the R-help
mailing list