Entering edit mode
4.1 years ago
anasjamshed
▴
130
## pvalues are given to retrieve the genes which pass the p values
for (i in c(0.01, 0.05, 0.001, 1e-04, 1e-05, 1e-06, 1e-07)) print(paste("genes with p-values smaller than",
i, length(which(pvals < i))))
when I try to run this script the following error comes :
Error in which(pvals < i) : object 'pvals' not found
help to overcome this problem
brother pvals is a function to calculate p value its not variable
You sure dude? In your code, you are passing it as the first argument to the
which()
functionThe way you have written your code, pvals is a variable.
Functions need inputs. They don't just sit there as barewords.
sorry I already declared the variable after making t-test function
What you're trying to do I would have done a different way, i.e., using Limma (as I know that you are working on microarray data). After that, simple
subset()
commands on the Limma output could get you want.If you want to continue with your current code, then:
for
loops without first testing a few passes (by setting pre-specified values ofi
, in this case)message()
commands to your loop, too, so that you can verify and QC check each pass.Functions do not always need inputs:
foo <- function(){ 1+1 }
orSys.Date()
, they could also sit as "barewords":do.call(rbind, mydata)
.But, yes, agree, in this case pvals is a variable.