Learn R Programming

nprcgenekeepr (version 3.0.0)

fixColumnNames: Standardize pedigree column names

Description

Standardizing converts the names to lower case, removes spaces, periods and underscores, and then renames by substring: egoid and ego become id, sireid becomes sire, damid becomes dam, birthdate becomes birth and deathdate becomes death. recordstatus, fromcenter and geographicorigin are restored to their camel case forms; a header already spelled recordStatus, fromCenter or geographicOrigin is not recorded as a change. The headers first_name and second_name keep their underscore. The matching is unanchored, so any name that contains one of these strings is changed (for example, category becomes catidry). A header that is NA is read as a blank one, so a nameless column is reported the way a column with a blank header is.

Usage

fixColumnNames(orgCols, errorLst)

Value

A list object with newColNames and errorLst with a record of all changes made.

Arguments

orgCols

character vector with ordered list of column names found in a pedigree file. A name that is NA counts as blank.

errorLst

list object with places to store the various column name changes, as returned by getEmptyErrorLst.

Examples

Run this code
library(nprcgenekeepr)
fixColumnNames(c("Sire_ID", "EGO", "DAM", "Id", "birth_date"),
  errorLst = getEmptyErrorLst()
)

Run the code above in your browser using DataLab