[R] (2) Questions

Liaw, Andy andy_liaw at merck.com
Tue Feb 24 00:54:59 CET 2004


> From: cbarrera at umich.edu
> 
> Hi Fellows from R-Help List!
> 
> My questions are basic since i an new with R. I am very 
> acquainted with Matlab &
> Gauss (the compentence, I guess). Anyhow, 
> 
> (1) I am trying to get R execute comands made or built as 
> text, so that one can
> feed a particular option with many variations coming from a 
> text file. Is this
> possible with the free version? For instance, there exists 
> the eval comand in
> Matlab, which executes the matlab comand in the text argument 
> incoming thru
> eval.

I guess you are looking for... eval():

> cmd <- "x <- rnorm(30); summary(x)"
> eval(parse(text=cmd))
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-1.6040 -0.3406  0.1896  0.1868  0.8361  1.8930 

Not sure what you mean by `free version'.  Do you know of a non-free
version?

> (2) Is there any way to avoid the automatic stop of a 
> redundant NL estimation,
> like for instance, the one behind arima()? Usually, when the 
> NL problem has
> spikes or the like, even the global optimizer procedures 
> stop. If many models
> are supposed to be estimated and you just want to bypass 
> those badly-behaved
> models (and store the many statistic values just as NAs), 
> such a stop makes you
> correct the loop indexes and re-run the program. How to avoid it?

I guess you are looking for try() or tryCatch().

HTH,
Andy
 
> Best
> 
> Carlos
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list