Hi again,
 
It seems one line in my function came chopped for whatever reason ....
 
so the if else statement below should be:
if (pval==0) p_value <- "<2.2e-16" else p_value <- pval
 
Thanks,
 
Monica
 
 
> Date: Wed, 23 Jul 2008 13:24:45 -0500> From: [EMAIL PROTECTED]> Subject: Re: 
> [R] Warning message in if else statement> To: [EMAIL PROTECTED]> > hi monica: 
> i don't understand the statement below. could that be related > to your 
> problem ?> > if (pval==0) p_value <- "<- pval> > > > > > On Wed, Jul 23, 2008 
> at 2:11 PM, Monica Pisica wrote:> > > Hi Erik,> >> > Thanks for your answer. 
> I did print the p-value just before the > > statement and it is only one 
> value – or at least I see only one value > > ….. that is strange.> >> > I am 
> doing a test and I want to see what is it's p-value ….for example > > my 
> function "myf" is like that:> >> > myf <- function(m, se, conf.int)> > {> > z 
> <- qnorm((1+conf.int)/2)> > pval <- (1 - pnorm(abs(m/se)))*2> > if (pval==0) 
> p_value <- "<- pval> > tst <- data.frame(m/se, p_value, m - z*se, m + z*se)> 
> > names(tst) <- c("m/se", "p-value", "C.I.1","C.I.2")> > print(tst, quote = 
> F)> > }> > If m = 0.3913681 and se = 0.04628602 pval = 0 so I am testing if 
> pval > > = 0 and I am reporting a very small number …. Maybe I should report 
> 0 > > but sincerely I don't quite like it so I rather report a p-values less 
> > > than 2.2e-16 which is 0 for all practicality – I would say. If I use > > 
> this function as it is …. No problems, if I incorporate inside a > > 
> different function so to be used internally I get the warning. Any > > idea 
> why?> >> > Thanks,> >> > Monica> >> >> >> >> Date: Wed, 23 Jul 2008 12:24:55 
> -0500> >> From: [EMAIL PROTECTED]> >> To: [EMAIL PROTECTED]> >> CC: 
> r-help@r-project.org> >> Subject: Re: [R] Warning message in if else 
> statement> >>> >> Monica -> >>> >> Monica Pisica wrote:> >>> Hi,> >>>> >>> I 
> am using an if else statement inside a function …. If I use that> >>> 
> function I have no problems …. If I use the function with the if > >>> else> 
> >>> statement inside a second function I get the following waring:> >>>> >>> 
> Warning message: In if (pval == 0) p_value <- "< 2.2e-16" else> >>> p_value 
> <- pval : the condition has length> 1 and only the first> >>> element will be 
> used> >>> >> This means that pval has more than one element, try printing its 
> > >> value> >> immediately before the if statement to see what it is and how 
> it got> >> that way.> >>> >> I also might ask what exactly you're doing with 
> 'real p-values' and> >> testing whether they equal 0?> >>> >>>> >>> Using the 
> second function I get the expected results, with a real> >>> p-value even if 
> it is extremely small, or "> >>> 
> _________________________________________________________________> >>> 
> [[elided Hotmail spam]]> >>>> >>> 
> ______________________________________________ R-help@r-project.org> >>> 
> mailing list 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.> >>>> >> > 
> _________________________________________________________________> >> >> > 
> enger2_072008> > ______________________________________________> > 
> R-help@r-project.org mailing list> > 
> 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.
_________________________________________________________________


enger2_072008
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to