Learn R Programming

strvalidator (version 1.5.2)

addData: Adds New Data Columns to a Data Frame

Description

Adds values from columns in 'new.data' to 'data' by keys.

Usage

addData(data, new.data, by.col, then.by.col = NULL, exact = TRUE,
  ignore.case = TRUE, debug = FALSE)

Arguments

data
Data frame containing your main data.
new.data
Data frame containing information you want to add to 'data'.
by.col
character, primary key column.
then.by.col
character, secondary key column.
exact
logical, TRUE matches keys exact.
ignore.case
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 'new.data' is added to data frame 'data' based on primary key value in column 'by.col', and optionally on secondary key values in column 'then.by.col'.

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, new.data=y, by.col="Marker")
print(x)
print(y)
print(z)

Run the code above in your browser using DataLab