nievergeltlab
5/1/2017 - 7:08 PM

Merge PLINK phenotype and covariates in R

Merge PLINK phenotype and covariates in R

famfile <- read.table('/home/cnieverg/MEG2/qc/pts_meg2_mix_am.fam',header=F,stringsAsFactors=F)
names(famfile) <- c("FID","IID","F","M","Gender","Pheno")

mds <- read.table('/home/cnieverg/MEG2/qc/pca/pts_meg2_mix_am-qc-eu1_pca.menv.mds_cov',header=T,stringsAsFactors=F)

dat <- merge(famfile,mds,by=c("FID","IID"))


#Number of analyzed subjects of European ancestry
dim(dat)[1]

#Number of analyzed cases/controls of European ancestry, overall
table(dat$Pheno)

#Cross tabs for pool of analyzed subjects, by gender
table(dat$Gender,dat$Pheno)