[R-SIG-Mac] [R] Trouble loading "saved" Rdata

David Winsemius dwinsemius at comcast.net
Sun Aug 15 22:29:01 CEST 2010


cross-posting to R-SIG-Mac

On Aug 15, 2010, at 4:07 PM, steven mosher wrote:

> I think it came down to my actual program having a function that  
> saved the
> objects it was passed with a .RData extension as opposed to .Rdata

I guess you have figured out that if you save with <name>.Rdata or  
<name>.Rdta  and try to load() as "<name>.RData", the combined R-MacOS  
software is not going to give you what you expect. If on the other  
hand you had click-hold-dragged those .RData files to the R icon on  
your Dock, you may have gotten the expected behavior.

You can change the file extensions which will be recognized (although  
not necessarily displayed with the proper R-icon inFfinder windows) by  
changing the default programs in a GetInfo window from the system.

I also checked to see what would happen if I changed the extension to  
".junk" and then dragged .... Turns out that the R interpreter  
searches for a file named test.r and when it finds it it loads it into  
an editing window. (That was _not_ what I expected.)

-- 
David.
>
> Rechecking the whole thing.
>
> On Sun, Aug 15, 2010 at 11:05 AM, Joshua Wiley  
> <jwiley.psych at gmail.com>wrote:
>
>> Steven,
>>
>> I have exited my R session and restarted and I can load the file
>> without issue.  I have also tried loading the saved data on some  
>> older
>> versions of R (2.10.1 and 2.11.0) and Windows (XP).  Have you tried
>> recreating the test object, ensuring that it is not NULL itself,
>> resaving it, and then see if loading it works better?
>>
>> Josh
>>
>> On Sun, Aug 15, 2010 at 12:06 AM, steven mosher <moshersteven at gmail.com 
>> >
>> wrote:
>>> Did you exit R and then return?
>>> fname<-"test.Rdata"
>>> full<-file.path("Example",fname,fsep=.Platform$file.sep)
>>> full
>>> [1] "Example/test.Rdata"
>>> load(full)
>>> test
>>> NULL
>>>> sessionInfo()
>>> R version 2.11.1 (2010-05-31)
>>> x86_64-apple-darwin9.8.0
>>> locale:
>>> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>> loaded via a namespace (and not attached):
>>> [1] tools_2.11.1
>>> On Sat, Aug 14, 2010 at 5:35 PM, Joshua Wiley <jwiley.psych at gmail.com 
>>> >
>>> wrote:
>>>>
>>>> That worked for me once I properly quoted "test.RData" on
>>>>
>>>>> sessionInfo()
>>>> R version 2.11.1 (2010-05-31)
>>>> x86_64-pc-mingw32
>>>>
>>>> locale:
>>>> [1] LC_COLLATE=English_United States.1252
>>>> [2] LC_CTYPE=English_United States.1252
>>>> [3] LC_MONETARY=English_United States.1252
>>>> [4] LC_NUMERIC=C
>>>> [5] LC_TIME=English_United States.1252
>>>>
>>>> If correcting the quoting does not help you, perhaps you can report
>>>> the results of sessionInfo()
>>>>
>>>> Cheers,
>>>>
>>>> Josh
>>>>
>>>> On Sat, Aug 14, 2010 at 5:14 PM, steven mosher <moshersteven at gmail.com 
>>>> >
>>>> wrote:
>>>>> In the particular application I have I save "test.Rdata" to a sub
>>>>> directory
>>>>> dir<-"Example"
>>>>> dir.create(dir)
>>>>> test<-data.frame(a=c(1,2,3),b=c(3,4,5)
>>>>>
>>>>> full<-file.path(dir,"test.Rdata,fsep=.Platform$file.sep)
>>>>> save(test,file=full)
>>>>> load(full)
>>>>> returns NULL
>>>>>
>>>>> it works fine when the object is saved to the working directory,  
>>>>> but
>>>>> fails
>>>>> when saved to a sub directory.
>>>>> The Rdata is there. Bytes are in it. but loading it doesnt work.
>>>>>
>>>>>       [[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> R-help at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Joshua Wiley
>>>> Ph.D. Student, Health Psychology
>>>> University of California, Los Angeles
>>>> http://www.joshuawiley.com/
>>>
>>>
>>
>>
>>
>> --
>> Joshua Wiley
>> Ph.D. Student, Health Psychology
>> University of California, Los Angeles
>> http://www.joshuawiley.com/
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-SIG-Mac mailing list