preparePhenotype: Process a table of phenotypes

Description

Given a data.frame containing phenotypic variables, select the desired columns and transform them to the desired types.

Usage

1
2
preparePhenotype(phenotypes, variable_names, variable_types = rep(NA,
  length(variable_names)))

Arguments

phenotypes

Data.frame with the phenotypic features

variable_names

Vector with the names or the positions of the desired variables.

variable_types

Vector with the types of the variables.

Details

preparePhenotype supports five types of variables. Categorical and continuous correspond to factor and numerical types in R. The other three are genomic models as defined in SNPassoc: dominant, recessive and additive. In order to use these types, only two alleles can be present and genotypes should be specified in the form a/b.

If transformation of variables is not needed, the variable_types can be passed as a vector of NA.

Value

Data.frame with the columns selected and with the types desired.

Examples

1
2
3
4
5
pheno <- data.frame(a = sample(letters[1:2], 5, replace = TRUE), b = runif(5), 
c = sample(c("a/a","a/b", "b/b"), 5, replace = TRUE))
pheno <- preparePhenotype(pheno, variable_names = c("a", "c"), 
variable_types = c("categorical", "dominant"))
pheno

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.