Hi, I have two scripts, one creates a data structure (a list of data frames + some attributes) and saves it via saveRDS. The second script reads the RDS file (outside of any function) and data <- readRDS (name) works, but data <<- readRDS (name) creates the error Error: cannot change value of locked binding for 'data' Any idea what goes wrong? Thanks Sigbert -- http://u.hu-berlin.de/sk
Try calling it something other than data. On 24/02/2016 09:26, Sigbert Klinke wrote:> Hi, > > I have two scripts, one creates a data structure (a list of data frames > + some attributes) and saves it via saveRDS. > > The second script reads the RDS file (outside of any function) and > > data <- readRDS (name) > > works, but > > data <<- readRDS (name) > > creates the error > > Error: cannot change value of locked binding for 'data' > > Any idea what goes wrong? > > Thanks Sigbert >-- Michael http://www.dewey.myzen.co.uk/home.html
Hi, thanks, using test <<- readRDS (name) it worked. But why? Best Sigbert Am 24.02.2016 um 10:39 schrieb Michael Dewey:> Try calling it something other than data. > > On 24/02/2016 09:26, Sigbert Klinke wrote: >> Hi, >> >> I have two scripts, one creates a data structure (a list of data frames >> + some attributes) and saves it via saveRDS. >> >> The second script reads the RDS file (outside of any function) and >> >> data <- readRDS (name) >> >> works, but >> >> data <<- readRDS (name) >> >> creates the error >> >> Error: cannot change value of locked binding for 'data' >> >> Any idea what goes wrong? >> >> Thanks Sigbert >> >-- http://u.hu-berlin.de/sk
On 24/02/2016 4:26 AM, Sigbert Klinke wrote:> Hi, > > I have two scripts, one creates a data structure (a list of data frames > + some attributes) and saves it via saveRDS. > > The second script reads the RDS file (outside of any function) and > > data <- readRDS (name) > > works, but > > data <<- readRDS (name) > > creates the error > > Error: cannot change value of locked binding for 'data' > > Any idea what goes wrong?"data <<-" looks for an existing object named data in a parent environment and changes it. But the existing object is in the utils namespace, and you're not allowed to change things there. Duncan Murdoch