Created
May 1, 2017 19:08
-
-
Save nievergeltlab/3531d496f94c101f04968b8e196f2f9d to your computer and use it in GitHub Desktop.
Merge PLINK phenotype and covariates in R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment