R/maxstat.setupSNP.R

Defines functions maxstat.setupSNP

Documented in maxstat.setupSNP

maxstat.setupSNP<-function(x, y, colSNPs=attr(x,"colSNPs"), ...)
{
 if(missing(y))
  stop("a case-control variable must be indicated in the second argument") 
 
 y<-deparse(substitute(y))
  if (!exists(y)) y<-x[,y] else y<-get(y)
 if(length(table(y))>2)
  stop("case-control variable must have only 2 levels")  

 ans<-sapply(x[,colSNPs, drop=FALSE], function(o) maxstat(y, o, ...))
 class(ans)<-"maxstat"
 ans
}
isglobal-brge/SNPassoc documentation built on May 15, 2023, 8:10 p.m.