addColor: Add Color Information.

View source: R/addColor.r

addColorR Documentation

Add Color Information.

Description

Add color information 'Color', 'Dye' or 'R Color'.

Usage

addColor(
  data,
  kit = NA,
  have = NA,
  need = NA,
  overwrite = FALSE,
  ignore.case = FALSE,
  debug = FALSE
)

Arguments

data

data frame or vector.

kit

string representing the forensic STR kit used. Default is NA, in which case 'have' must contain a valid column.

have

character string to specify color column to be matched. Default is NA, in which case color information is derived from 'kit' and added to a column named 'Color'. If 'data' is a vector 'have' must be a single string.

need

character string or string vector to specify color columns to be added. Default is NA, in which case all columns will be added. If 'data' is a vector 'need' must be a single string.

overwrite

logical if TRUE and column exist it will be overwritten.

ignore.case

logical if TRUE case in marker names will be ignored.

debug

logical indicating printing debug information.

Details

Primers in forensic STR typing kits are labeled with a fluorescent dye. The dyes are represented with single letters (Dye) in exported result files or with strings (Color) in 'panels' files. For visualization in R the R color names are used (R.Color). The function can add new color schemes matched to the existing, or it can convert a vector containing one scheme to another.

Value

data.frame with additional columns for added colors, or vector with converted values.

Examples

# Get marker and colors for SGM Plus.
df <- getKit("SGMPlus", what = "Color")
# Add dye color.
dfDye <- addColor(data = df, need = "Dye")
# Add all color alternatives.
dfAll <- addColor(data = df)
# Convert a dye vector to R colors
addColor(data = c("R", "G", "Y", "B"), have = "dye", need = "r.color")

strvalidator documentation built on July 26, 2023, 5:45 p.m.