File: mf.gindx.q

package info (click to toggle)
r-cran-haplo.stats 1.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,204 kB
  • ctags: 116
  • sloc: ansic: 1,827; makefile: 1
file content (25 lines) | stat: -rw-r--r-- 767 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#$Author: sinnwell $
#$Date: 2003/12/08 20:05:21 $
#$Header: /people/biostat3/sinnwell/Haplo/Make/RCS/mf.gindx.q,v 1.2 2003/12/08 20:05:21 sinnwell Exp $
#$Locker:  $
#$Log: mf.gindx.q,v $
#Revision 1.2  2003/12/08 20:05:21  sinnwell
#changed rep(F, to rep(0,nvars)
#
#Revision 1.1  2003/09/16 16:02:57  schaid
#Initial revision
#
 mf.gindx <- function(m){
    # determine which item in a model.frame is the genotype matrix
    nvars<- length(m)
    typevars <- rep(0,nvars)
    for(i in 1:nvars){
      typevars[i] <- data.class(m[[i]])
    }

   gindx <- (1:nvars)[typevars=="model.matrix" | typevars=="matrix"]

   if(length(gindx)==0) stop("No geno matrix in data frame")
   if(length(gindx) >1) stop("More than 1 geno matrix in data frame")
   return(gindx)
  }