user1471980
user1471980

Reputation: 10626

Loading RData files within a Rscript

I am trying to load an .Rdata file within a rscript manipulate the data etc.

when I do this in R console int works:

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?

Upvotes: 4

Views: 7602

Answers (1)

GSee
GSee

Reputation: 49810

You can create an environment and load the data into the environment.

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

Upvotes: 6

Related Questions