Learn R Programming

strvalidator (version 1.3.0)

addData: Adds new data columns to a data frame

Description

addData Adds columns in 'newData' to 'data' by column 'byCol'.

Usage

addData(data, newData, byCol, thenByCol = NULL, exact = TRUE,
  ignoreCase = TRUE, debug = FALSE)

Arguments

data
Data frame containing your main data.
newData
Data frame containing information you want to add to 'data'.
byCol
character, key column.
thenByCol
character, key column level 2.
exact
logical, TRUE matches keys exact.
ignoreCase
logical, TRUE ignore case.
debug
logical indicating printing debug information.

Value

  • data.frame the original data frame containing additional columns.

Details

Information in columns in data frame 'newData' is added to data frame 'data' based on value in column 'byCol' and optionally on 'thenByCol'.

Examples

Run this code
# Get marker names and alleles for Promega PowerPlex ESX 17.
x <- getKit("ESX17", what="Allele")
# Get marker names and colors for Promega PowerPlex ESX 17.
y <- getKit("ESX17", what="Color")
# Add color information to allele information.
z <- addData(data=x, newData=y, byCol="Marker")
print(x)
print(y)
print(z)

Run the code above in your browser using DataLab