addPhecodeInfo: Add phecode descriptions and group information to existing...

View source: R/addPhecodeInfo.R

addPhecodeInfoR Documentation

Add phecode descriptions and group information to existing data.

Description

addPhecodeInfo adds the phecode description and group information, found in the data frame pheinfo. Requires the full three digit phecodes in character format. This function replaces addPhewasDescription and addPhewasGroups.

Usage

addPhecodeInfo(data, descriptions=T, groups=T, groupnums=F, groupcolors=F)

Arguments

data

Data frame containing the a column with phecodes. Can additionally be a character vector of phecodes. See details for requirements.

descriptions

Add the phecode descriptions? Default is TRUE (yes).

groups

Add the phecode group names? Default is TRUE (yes).

groupnums

Add the phecode group numbers? Default is FALSE (no). Used in plotting

groupcolors

Add the phecode group colors? Default is FALSE (no). Used in plotting

Details

This function provides a quick way to add phecode descriptions and group names. It will select the first column matching any of "phecode", "phewas" or "pheno" to merge on. If none is identified, it reports a warning and attempts the merge with the first column. Phecodes must be character vectors, otherwise they may have inaccurate mappings. If PheWAS codes are factors it will convert them to characters, give a warning, and attempt to map them. If a character (or factor) variable or vector is passed in, it will return code descriptions for those codes.

Value

Data frame with added columns:

description

The description of the phecode.

group

The name of the phecode group.

groupnum

The assigned number of the phecode group.

color

The default plotting color of the phecode group.


PheWAS/PheWAS documentation built on July 3, 2023, 3:40 p.m.