Question about ifelse in R
Hello,
I have a loop code where I find the linear regression of several variables, and I report the F test and the P-value and the code stope when the regression with intercept only
so I wrote in the loop the following
> mymodel=lm(gene ~ . ,data=mydata)
mm=(summary(mymodel))
>
> ifelse(mm$fstatistic==NULL,NA,pvalue)
> pvalue= pf(mm$fstatistic[1],mm$fstatistic[2],mm$fstatistic[3],lower.tail=FALSE)
but it doesn't work as I get the following error
Error in pf(mm$fstatistic[1], mm$fstatistic[2], mm$fstatistic[3], lower.tail = FALSE) :
Non-numeric argument to mathematical function
any help ?
• 1,666 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Not really a bioinformatics question. Try Cross Validated or (probably better) R-help mailing list.
Hello mms140130!
We believe that this post does not fit the main topic of this site.
Not a bioinformatics question.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
I think there is an R option in the post tags , why it is there and we can't ask R questions?
Because we don't want to have pure R programming questions that are lacking bioinformatics context. Hint: please check the help for
?is.null ?is.na, and?ifelseto understand how to properly check for missing values.did you the check the class of variables that you are passing to pf?
The code has more serious problems that show that it is a programming question: