Friedericksen
2009-Apr-27 12:52 UTC
[R] A way to get the R data stored temporarily in working memory?
Hey guys, I have a problem: I created a silly for loop without saving the results on each step. After a while I realised that it will take days to finish the loop until I get the results. Is there a way to get the data R saves in working memory or in a temporary file while runing the loop? So that stoping the loop will not result in complete data loss? Thank you very much! Greetings, Friederiksen
ONKELINX, Thierry
2009-Apr-27 13:52 UTC
[R] A way to get the R data stored temporarily in working memory?
Have a look at ?save and ?load. Those function will allow you to save an R object to a file and reload it when needed. HTH, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -----Oorspronkelijk bericht----- Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Namens Friedericksen Verzonden: maandag 27 april 2009 14:53 Aan: r-help at stat.math.ethz.ch Onderwerp: [R] A way to get the R data stored temporarily in working memory? Hey guys, I have a problem: I created a silly for loop without saving the results on each step. After a while I realised that it will take days to finish the loop until I get the results. Is there a way to get the data R saves in working memory or in a temporary file while runing the loop? So that stoping the loop will not result in complete data loss? Thank you very much! Greetings, Friederiksen ______________________________________________ R-help at r-project.org mailing list stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
Duncan Murdoch
2009-Apr-27 13:58 UTC
[R] A way to get the R data stored temporarily in working memory?
On 4/27/2009 8:52 AM, Friedericksen wrote:> Hey guys, > > I have a problem: I created a silly for loop without saving the results > on each step. After a while I realised that it will take days to finish > the loop until I get the results. > > Is there a way to get the data R saves in working memory or in a > temporary file while runing the loop? So that stoping the loop will not > result in complete data loss? > > Thank you very much!You can use an explicit save() to write out a list of variables (or save.image() to write out all of them) but then you need to work out how to restart from one of these images. Duncan Murdoch
Andrew Dolman
2009-Apr-27 14:21 UTC
[R] A way to get the R data stored temporarily in working memory?
Using write() with append=T should work. Just be careful not to open the text file with a program that will lock it while the loop is still running. Text editors will not usually lock the file so in windows you could use notepad to take a look at the output and copy/paste to somewhere else. e.g. a <- vector(length=100000) for (i in 1:100000){ a[i]<-rnorm(1) write(a[i], "temp.txt", append=T) ## append your new bit of data to the text file at each iteration of the loop } andydolman@gmail.com 2009/4/27 Friedericksen <golum23@gmx.de>> Hey guys, > > I have a problem: I created a silly for loop without saving the results on > each step. After a while I realised that it will take days to finish the > loop until I get the results. > > Is there a way to get the data R saves in working memory or in a temporary > file while runing the loop? So that stoping the loop will not result in > complete data loss? > > Thank you very much! > > Greetings, > Friederiksen > > ______________________________________________ > R-help@r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Friedericksen
2009-Apr-27 18:11 UTC
[R] A way to get the R data stored temporarily in working memory?
Hey, that is very cool! But there is a problem: I use Emacs with ESS. When I press ESC, I get some emacs keybinding. What is R doing when I press ESC? Which function is then executed? I think it should also work with ESS, but I have to press the specific keybinding. Thank you very much for the answer! Greetings
Possibly Parallel Threads
- How to get a specific named element in a nested list
- Fwd: Bug Reporting
- Computer Modern Fonts in R graphic
- error : virPidFileAcquirePath:345 : Failed to acquire pid file '/home/corey/.libvirt/libvirtd.pid': Resource temporarily unavailable
- ubuntu packages patch