Description Usage Arguments Details See Also Examples
This function writes a space-delimited file with header, with the obligatory first two columns FID and IID. Use this function to write phenotype and covariate files for downstream genetic analysis in plink - the format is the same.
1 2  | ukb_gen_write_plink(x, path, ukb.variables, ukb.id = "eid",
  na.strings = "NA")
 | 
x | 
 A UKB dataset.  | 
path | 
 A path to a file.  | 
ukb.variables | 
 A character vector of either the phenotypes for a PLINK phenotype file, or covariates for a PLINK covariate file.  | 
ukb.id | 
 The id variable name (default = "eid").  | 
na.strings | 
 String used for missing values. Defaults to NA.  | 
The function writes the id variable in your dataset to the first two columns of the output file with the names FID and IID - you do not need to have two id columns in the data.frame passed to the argument x. Use the --pheno-name and --covar-name PLINK flags to select columns by name. See the PLINK documentation for the --pheno, --mpheno, --pheno-name, and --covar, --covar-name, --covar-number flags.
ukb_gen_read_sample to read a sample file, and ukb_gen_write_bgenie to write phenotype and covariate files to BGENIE format.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  | ## Not run: 
# Automatically inserts FID IID columns required by PLINK
ukb_gen_write_plink(
   my_ukb_data,
   path = "my_ukb_plink.pheno",
   ukb.variables = c("height", "weight", "iq")
)
ukb_gen_write_plink(
   my_ukb_data,
   path = "my_ukb_plink.cov",
   ukb.variables = c("age", "socioeconomic_status", "genetic_pcs")
)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.