get_pheno: Get the phenotype matrix

View source: R/get_pheno.R

get_phenoR Documentation

Get the phenotype matrix

Description

This function can return a number of different trait matrices depending on the arguments.

Usage

get_pheno(
  data_obj,
  scan_what = c("eigentraits", "normalized_traits", "raw_traits"),
  covar = NULL
)

Arguments

data_obj

a Cape object

scan_what

A character string. One of "eigentraits", "normalized.trait", or "raw_traits." If "eigentraits" the function returns the eigentraits matrix. If "normalized_traits" the function returns the trait matrix after mean-centering and normalizing. If "raw.trait" the function returns the trait matrix before mean-centering and normalization were applied.

covar

A character value indicating which, if any, covariates the traits should be adjusted for. If covariates are specified, the function fits a linear model to specify the traits with the covariates and returns the matrix of residuals (i.e. the traits after adjusting for the covariates).

Value

A matrix in which each column is a trait, and each row is an individual. The values correspond to the argument settings described above.

Examples

## Not run: 
#get eigentrait matrix
eigenT <- get_pheno(data_obj, "eigentraits")

#get normalized trait matrix
pheno <- get_pheno(data_obj, "normalized_traits")

#get normalized traits adjusted for sex
pheno <- get_pheno(data_obj, "normalized_traits", covar = "sex")

#get raw trait matrix
pheno <- get_pheno(data_obj, "raw_traits")

## End(Not run)


cape documentation built on May 20, 2022, 1:06 a.m.