Hello, All!

How might one accomplish this using the by() function?
m1 is a data frame.

# populate column "m1$major_allele"
for ( i in 1:length(m1$major_allele)) {
  if ( m1$Freq1[i] == m1$MAF[i]){
    m1$major_allele[i] = m1$Al1[i]
  }
  else{
     m1$major_allele[i] = m1$Al2[i]
  }
}


Jim

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to