Hi,
I think that putting all your objects into one single list would be
easier, both to handle it and to save it.
To do it, you can create an empty list with 1000 elements before running
your function and then run your function in a loop (or something
similar) with the output of each run being saved in one element of the
big list.
Something like this:
big.list <- vector(mode="list", length=1000)
for (i in 1:1000){
big.list[[i]] <- your.function(...)
}
I also like to name the elements of my list, especially when the
structure gets complicated.
And then you just need to save big.list either with save() or with
R.utils::saveOjbect().
HTH,
Ivan
PS: answer to the list as well, so you have better chance to get better
answers.
--
Ivan Calandra, ATER
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
https://www.researchgate.net/profile/Ivan_Calandra
Le 06/02/15 09:13, Alaios a écrit :
Thanks for the answer.Then I guess that your recommendation is to save
each of these structures independently and then load those files one
by one. I thought it would be easier to build a big list (I am not
sure still how to do that) that contains the 1000 results of my
function (with their respective sublists) and save that one once at my
file.
What do you think of this option?
Regards
Alex
On Thursday, February 5, 2015 2:43 PM, Ivan Calandra
<ivan.calan...@univ-reims.fr> wrote:
Hi,
I generally prefer using the functions saveObject() and loadObject()
from the R.utils package. I like that you load directly to an object in
the R workspace.
HTH,
Ivan
--
Ivan Calandra, ATER
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr <mailto:ivan.calan...@univ-reims.fr>
https://www.researchgate.net/profile/Ivan_Calandra
Le 05/02/15 14:07, Olivier Crouzet a écrit :
> Hi, have a look at save() and load().
>
> You can save part of your workspace to a file (save()) and load it
from this file (load()). Of course the file format is R specific (but
its specifications are free) You may easily share the file with other
R users.
>
> Olivier.
>
> --
> Olivier Crouzet
> LLING - Laboratoire de Linguistique de Nantes - EA3827
> Université de Nantes
>
> -----Original Message-----
> From: Alaios via R-help <r-help@r-project.org
<mailto:r-help@r-project.org>>
> Sender: "R-help" <r-help-boun...@r-project.org
<mailto:r-help-boun...@r-project.org>>Date: Thu, 5 Feb 2015 12:57:42
> To: R-help Mailing List<r-help@r-project.org
<mailto:r-help@r-project.org>>
> Reply-To: Alaios <ala...@yahoo.com <mailto:ala...@yahoo.com>>
> Subject: [R] save structure to be accesible later
>
> Dear all,I have a function that returns the following list. At the
end I will call my function 1000 times and I want to keep for each of
these 1000 "results" (the structure as given below)in an order to be
accessible later (Load the 1000 results and access them within a for
loop for example)
> How should I approach the issue?I would like to thank you for your
exampleRegardsAlex
> P,S The result of my function
>
>
>
> str(fitcass1)
> List of 10
> $ parameters :'data.frame': 2 obs. of 3 variables:
> ..$ pi : num [1:2] 0.833 0.167
> ..$ mu : num [1:2] 8828 110000
> ..$ sigma: num [1:2] 18085 1543
> $ se :'data.frame': 2 obs. of 3 variables:
> ..$ pi.se : num [1:2] NA NA
> ..$ mu.se : num [1:2] NA NA
> ..$ sigma.se: num [1:2] NA NA
> $ distribution: chr "gamma"
> $ constraint :List of 8
> ..$ conpi : chr "NONE"
> ..$ conmu : chr "NONE"
> ..$ consigma: chr "NONE"
> ..$ fixpi : NULL
> ..$ fixmu : NULL
> ..$ fixsigma: NULL
> ..$ cov : NULL
> ..$ size : NULL
> $ chisq : num 52.4
> $ df : num 5
> $ P : num 4.57e-10
> $ vmat : num [1:5, 1:5] NA NA NA NA NA NA NA NA NA NA ...
> $ mixdata :Classes ‘mixdata’ and 'data.frame': 11 obs. of 2
variables:
> ..$ X : num [1:11] 1e+04 2e+04 3e+04 4e+04 5e+04 6e+04 7e+04
8e+04 9e+04 1e+05 ...
> ..$ count: int [1:11] 993 137 82 30 21 5 7 14 21 2 ...
> $ usecondit : logi FALSE
> - attr(*, "class")= chr "mix"
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org <mailto:R-help@r-project.org> mailing list --
To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
> ______________________________________________
> R-help@r-project.org <mailto:R-help@r-project.org> mailing list --
To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org <mailto:R-help@r-project.org> mailing list -- To
UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
<http://www.r-project.org/posting-guide.html>
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.