简体   繁体   English

在rscript中加载Rdata文件

[英]loading Rdata files within a rscript

I am trying to load an .Rdata file within a rscript manipulate the data etc. 我试图在rscript中加载.Rdata文件来操纵数据等。

when I do this in R console int works: 当我在R console int中执行此操作时:

load("R.RData")
x<-Data ##Data is the object in R.data file

but when I put this in a script, I get errors: 但是当我把它放在脚本中时,我会收到错误:

 object of type 'environment' is not subsettable

any ideas? 有任何想法吗?

You can create an environment and load the data into the environment. 您可以创建环境并将数据加载到环境中。

tmpenv <- new.env()
load("R.RData", envir=tmpenv)
x <- tmpenv$Data

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM