以下脚本运行良好。不过,我想知道是否有可能直接获取向量x。
x <- c("print (\"Hallo world\")", "print (\"(Just an example)\")")
temporary_file <- tempfile()
write(x, file = temporary_file )
source(temporary_file)
答案 0 :(得分:2)
x <- c("print (\"Hallo world\")", "print (\"(Just an example)\")");
eval(parse(text=x));
## [1] "Hallo world"
## [1] "(Just an example)"