[R] problems editing R console

Mark Sharp msharp at txbiomed.org
Mon Jun 8 02:30:29 CEST 2015


Rosa,

See save() and load() functions for background. However, I suspect you will want to do something as described in the article in this link http://www.fromthebottomoftheheap.net/2012/04/01/saving-and-loading-r-objects/


Mark



R. Mark Sharp, Ph.D.
Director of Primate Records Database
Southwest National Primate Research Center
Texas Biomedical Research Institute
P.O. Box 760549
San Antonio, TX 78245-0549
Telephone: (210)258-9476
e-mail: msharp at TxBiomed.org



> On Jun 7, 2015, at 5:58 PM, Rosa Oliveira <rosita21 at gmail.com> wrote:
> 
> Dear Mark,
> 
> 
> I’ll try to explain better.
> 
> Imagine I write:
> 
> library(foreign)
> library(nlme)
> 
> set.seed(1000)
> n.sample<-10000 #sample size
> M <- 5
> DP_x <- 2
> x <- rnorm(n.sample,M,DP_x)
> p <- pnorm(-3+x)  
> y <- rbinom(n.sample,1,p)
> dp_erro <- 0.01
> erro <- rnorm(n.sample,0,dp_erro)
> x.erro <- x+erro
> 
> but with a function, with 2000 simulations. 
> I save my “output” and I get X.erro in a .txt file. (text edit file).
> 
> I do another setting with DP_x=3 and save, and so on.
> 
> For some reason I realize I’ve done my simulation the wrong way and I have to apply a correction, for example:
> 
> x.erro = 1.4X+erro, i.e. in the truth I could use my first X and erro values in each setting, but as it is in a .txt file I can’t use them any more. Is there a way to save the results in a  format that I can use the values? Just apply my corrections and don’t have to do the 2000 simulations for each setting again?
> 
> My problem is that the function I use takes 3 days running, and just 500 simulations :(
> 
> Best,
> RO
> 
> 
> Atenciosamente,
> Rosa Oliveira
> 
> -- 
> ____________________________________________________________________________
>  
> <smile.jpg>
> Rosa Celeste dos Santos Oliveira, 
> 
> E-mail: rosita21 at gmail.com
> Tlm: +351 939355143 
> Linkedin: https://pt.linkedin.com/in/rosacsoliveira
> ____________________________________________________________________________
> "Many admire, few know"
> Hippocrates
> 
>> On 07 Jun 2015, at 23:03, Mark Sharp <msharp at txbiomed.org> wrote:
>> 
>> I cannot understand your request as stated. Can you provide a small example?
>> 
>> Mark
>> 
>> R. Mark Sharp, Ph.D.
>> msharp at TxBiomed.org
>> 
>>> On Jun 7, 2015, at 2:49 PM, Rosa Oliveira <rosita21 at gmail.com> wrote:
>>> 
>>> Dear all,
>>> 
>>> I’m doing simulations on R, and as my code is being changed and improved I need to, sometimes, work in finished simulations, i.e, 
>>> 
>>> After my simulation is  over I need to settle another setting.
>>> The problem is that I need to get back to the previous result.
>>> 
>>> When I save the result it saves as txt, so I can’t edit that result any more.
>>> 
>>> Imagine I save a setting and save the mean, nonetheless, in another setting the mean as problems, so I have to ask the median.
>>> 
>>> As I have to have the same statistics to all settings, nowadays I have to run my first setting again.
>>> 
>>> My advisor told me that I could save another way so I can “edit” my first result. Is it possible?
>>> 
>>> I tried to save as "save my workplace", … but after I don’t know what to do with it.
>>> 
>>> Can you please help me?
>>> I know is a naive question, but I have to go through this every 3 days (time each simulation takes long). And my work is being delayed :(
>>> 
>>> 
>>> Best,
>>> RO
>>> 
>>> 
>>> 
>>> Atenciosamente,
>>> Rosa Oliveira
>>> 
>>> -- 
>>> ____________________________________________________________________________
>>> 
>>> 
>>> Rosa Celeste dos Santos Oliveira, 
>>> 
>>> E-mail: rosita21 at gmail.com
>>> Tlm: +351 939355143 
>>> Linkedin: https://pt.linkedin.com/in/rosacsoliveira
>>> ____________________________________________________________________________
>>> "Many admire, few know"
>>> Hippocrates
>>> 
>>> ______________________________________________
>>> R-help at 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.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 







More information about the R-help mailing list