[R] Problems saving an Object called by get
Ivan Calandra
ivan.calandra at uni-hamburg.de
Wed Apr 27 09:56:56 CEST 2011
Hi,
Not sure it is exactly what you're looking for, but it might help you:
save(PortafolioInicial, ...) ## you just save the original object
instead of the assign()ed one.
But when you load() it, you have to know its name, so it might be
difficult to use.
Even better (for me at least), is to use saveObject() from package R.utils:
saveObject(PortafolioInicial, file="whatever.Rbin")
The difference is that when you load the object, you have to assign it
to an object in the workspace (unlike with save/load) so that its
original name doesn't matter:
pt <- loadObject("whatever.Rbin")
HTH,
Ivan
Le 4/27/2011 05:59, Luis Felipe Parra a écrit :
> Sorry David, I understand what you mean but could you help with how it would
> be done more specifically.
>
> Thanks
>
> On Wed, Apr 27, 2011 at 11:27 AM, David Winsemius<dwinsemius at comcast.net>wrote:
>
>> On Apr 26, 2011, at 7:37 PM, Luis Felipe Parra wrote:
>>
>> Hello. I am trying to save an object which I created using assign as
>>> following:
>>>
>>> assign(paste(NombreAlgoritmo,"_Portafolio",sep=""),PortafolioInicial)
>>>
>>> save(get(paste(Algoritmo,"_Portafolio",sep="")),file=paste(camino,"\\Libreria\\Portafolio\\Port_",NombreAlgoritmo,"\\",NombreAlgoritmo,"_Portafolio.Rdata",sep=""))
>>>
>>> but I am getting the following error:
>>>
>>> Error in save(get(paste(NombreAlgoritmo, "_Portafolio", sep = "")), file =
>>> paste(camino, :
>>> object 'get(paste(NombreAlgoritmo, "_Portafolio", sep = ""))' not found
>>>
>>> Does anybody know how can this be done?
>>>
>>>
>> You need to save the names rather than the "got"()-ten objects.
>>
>>
>> --
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
> [[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.
>
--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de
**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php
More information about the R-help
mailing list