[R] IF STATEMENTS

Mary A. Marion mmstat at comcast.net
Fri Jul 10 22:04:26 CEST 2009


Hello,

I am working on using if statements.  What  is the error message telling 
me here and how do I correct for it?
I have tried various combinations of quotes.

Thank you.
Sincerely,
Mary A. Marion


#Find critical values
crit<-function(n,alpha,type)
{
if (type==twoSided)
{
alpha2=alpha/2
tL<-qt(alpha2,n-1)
tU<-qt(1-alpha2,n-1)
}
if (type==Lower)
{
 tL<- -9999
 tU<-qt(1-alpha,n-1)
}
if (type==Upper)   
{
tL<-qt(alpha,n-1)
tU<- 9999
}
criticalValues<-c(tL,tU)
round(criticalValues,3)
}
crit(n=50,alpha=.05,type=twoSided)
Error in crit(n = 50, alpha = 0.05, type = twoSided) :
  object 'twoSided' not found
 >
crit(n=50,alpha=.05,type=Lower)
crit(n=50,alpha=.05,type=Upper)




More information about the R-help mailing list