Open danli349 opened 1 year ago
Thanks for the excellent book! Could you please let me know what is wrong with my code? Thanks.
x <- list(var = 1, y = 2) var <- "y" eval(var) x$var `$`(x, var) `$`(x, "var") x[[var]] `$`(x, "y") `$`(x, eval(var))
[1] "y" [1] 1 [1] 1 [1] 1 [1] 2 [1] 2 Error in `$`(x, eval(var)) : invalid subscript type 'language'
Thanks for the excellent book! Could you please let me know what is wrong with my code? Thanks.