[R] attach() warning message

Duncan Murdoch murdoch at stats.uwo.ca
Wed May 10 20:46:19 CEST 2006


On 5/10/2006 2:02 PM, J.M. Breiwick wrote:
> Hi,
> 
> I am using R 2.3.0 and my .First() file has the following line which causes 
> a warning:
> attach(what="c:/r/jmb/.RData", pos=3)
> 
> I get the following message after .First() is loaded:
> 
> During startup - Warning message:
> use of NULL environment is deprecated
> 
> Is there a simple fix that will eliminate this warning message? Thanks.

This probably means you have some binary objects in your .RData which 
were produced under an earlier version of R and will not be compatible 
with R 2.4.x.  I think it will continue to make automatic conversions 
(we strive to be able to read old binary versions), but the automatic 
conversions might not be correct.

There are two things to do:

The simplest one is to ignore the warning, save your data from R 2.3.0, 
and hope that the automatic corrections were successful.  I recommend 
you backup the old file first, and test carefully afterwards.

A better solution is to load your .RData in the version of R that was 
used to create it, dump it in text format (using the dump() function), 
and then reload it into R 2.3.0 using source().  It is possible that 
this will create very small changes to some numerical values, since I 
don't think we guarantee that the text representation is always parsed 
to identical values.

If you've got a mixture of old and new items (because you have added new 
things), you may not be able to do this:  the old version of R may not 
be able to read the file.  In that case you can try dump() from R 2.3.0, 
  hoping that the automatic fixups were correct; you can look over the 
file (if it's not too large) to check.

In future, I'd recommend that you don't keep things in binary format; R 
changes, and you might run into this sort of problem again.  We try to 
keep backwards compatibility, but it's not always possible.

Duncan Murdoch




More information about the R-help mailing list