Learn R Programming

immunogenetr (version 0.3.1)

HLA_column_repair: HLA_column_repair

Description

This function will change column names that have the official HLA nomenclature (e.g. "HLA-A*" or "HLA-A") to a format more easily selected in tidyverse functions (e.g. "HLA_A"). The dash and asterisk are special characters in R, and makes selecting columns by name difficult. This function will also allow for easily changing back to WHO-compliant nomenclature (e.g. "HLA-A*").

Usage

HLA_column_repair(data, format = "tidyverse", asterisk = FALSE)

Value

A data frame object with column names renamed in the specified format.

Arguments

data

A data frame

format

Either "tidyverse" or "WHO".

asterisk

Logical value to return column with an asterisk.

Examples

Run this code
HLA_type <- data.frame(
  "HLA-A*" = c("01:01", "02:01"),
  "HLA-B*" = c("07:02", "08:01"),
  "HLA-C*" = c("03:04", "04:01"),
  stringsAsFactors = FALSE
)

HLA_column_repair(HLA_type, format = "tidyverse")

Run the code above in your browser using DataLab