Re: [R] Grep functions output

2013-08-05 Thread Lívio Cipriano
On 05 August 2013 11:11:22 Phil Spector wrote: > but most functions in R > that provide p-values make it possible to extract the p-value from the > result of the function call without using any text Thanks for your answer. In fact it's the simple way to do it. Regards Lívio Cipriano

Re: [R] Grep functions output

2013-08-05 Thread Jeff Newmiller
If you were to follow the recommendations in the footer of this email, you might get some better options than using grep. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#

Re: [R] Grep functions output

2013-08-05 Thread jim holtman
try this: > x <- "p-value = 0.0765" > sig <- as.numeric(sub(".*=(.*)", "\\1", x)) > > sig [1] 0.0765 > On Mon, Aug 5, 2013 at 10:41 AM, Lívio Cipriano wrote: > Hi, > > I'm writing some R scripts and I would like to grab outputs from R > functions > to control if tests. Example, one function o

[R] Grep functions output

2013-08-05 Thread Lívio Cipriano
Hi, I'm writing some R scripts and I would like to grab outputs from R functions to control if tests. Example, one function outputs something like "p-vale = 0.0765" and I want to program the following pseudo code in R sig = grep pvalue if (sig > 0.05) a() else b() Should I use