[R] Referencing a component of a large object (Error: slot NULL)

Andrea Lamont lamonta at mailbox.sc.edu
Fri Aug 28 21:17:20 CEST 2015


I am running a simulation and need to refer to a matrix of parameters from
a large object. Here is a snippet of the object structure itself:

Formal class 'mi' [package "mi"] with 3 slots
  ..@ call       : language .local(y = y, n.chains = ..2, max.minutes = 20000)
  ..@ data       :List of 100
  .. ..$ chain:1  :'data.frame':    10000 obs. of  76 variables:
Formal class 'missing_data.frame' [package "mi"] with 17 slots
  .. .. .. ..@ .Data       : list()
  .. .. .. ..@ variables   :List of 76
  .. .. .. .. ..$ y.obs.tx:Formal class 'binary' [package "mi"] with 27 slots...

The parameter list I need can be referenced by:

mi.control.i at data$'chain:1'@variables$y.obs.tx at parameters[30,]

Since this is a simulation, I would like to grab the parameters from each
chain and join them together in a matrix. I have this:

tf <- vector("list", numberofchains)for (j in 1:numberofchains){
  s <- paste("'chain:",j,"'" ,sep="")
  tf[[j]] =  mi.control.i at data$s at variables$y.obs.tx at parameters[30,]}

Within the loop, however, the reference to the object (tf[[j]]) does not
work. I get an error that reads

Error: trying to get slot "variables" from an object of a basic class
("NULL") with no slots


I am happy to send reproducible code, however, I obtain this object through
the package 'mi' and is computationally intensive. I'm not sure if it makes
it easier for folks. Let me know.

Any ideas?

	[[alternative HTML version deleted]]



More information about the R-help mailing list