[R] is this a bug? problem saving and restoring coxph objects

Thomas Lumley thomas at biostat.washington.edu
Sat Mar 25 21:31:54 CET 2000


On Sat, 25 Mar 2000, Thomas Lumley wrote:

> On Sat, 25 Mar 2000, Ramon Diaz-Uriarte wrote:
> 
> > I am using R 1.0.0 on Linux, and I am running into a problem with coxph objects
> > (library survival5).
> > 
> > If I fit a model that includes a frailty term with sparse=F (e.g
> > my.model<-coxph(Surv(t,censor)~trt+frailty(id,sparse=F))),
> > 
> > when I try to save all the objects (e.g., save.image()) I get the error:
> > 
> > > save.image()
> > Error in save(list = ls(all.names = TRUE), file = ".RData", oldstyle = FALSE) : 
> > 	NewWriteItem: unknown type 17
> > 
> > 
> 
> 
> > This seems like a bug. Where should I report it? Is there a workaround?
> 

This is actually two different bugs in the save/load code.

The first is that it cannot currently handle unevaluated ... argument.
Either of the workarounds I posted previously will fix this by removing
the unevaluated ... argument. This is what causes the 'unknown type 17'
error

The second is that an error while saving a file leads to the file being
improperly closed.  If you later save another file with the same name
there can be problems when R exits.  This causes the problems you have
after deleting the object.  The workarounds will stop this by preventing
the initial error.

If for some other reason you have an error while saving a file you should
a) delete the partially saved file
eg
  unlink(".RData")
and try again

or

b) save the file with a different name
  save.image(file=".aDifferentName")
and rename it after leaving R.
  mv .aDifferentName .RData


	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list