[R] Warning message in if else statement
Erik Iverson
iverson at biostat.wisc.edu
Wed Jul 23 19:24:55 CEST 2008
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 at 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.
>
More information about the R-help
mailing list