Learn R Programming

nprcgenekeepr (version 3.0.0)

toCharacter: Force dataframe columns to character

Description

Converts designated columns of a dataframe to character. Defaults to converting columns id, sire, and dam.

Usage

toCharacter(df, headers = c("id", "sire", "dam"))

Value

A dataframe with the specified columns converted to class "character" for display with xtables (in shiny)

Arguments

df

a dataframe. Columns named in headers are converted to character.

headers

character vector with the names of the columns to be converted to character class. Names that are not columns of df are skipped silently. Defaults to c("id", "sire", "dam").

Examples

Run this code
library(nprcgenekeepr)
pedGood <- nprcgenekeepr::pedGood
names(pedGood) <- c("id", "sire", "dam", "sex", "birth")
class(pedGood[["id"]])
pedGood <- toCharacter(pedGood)
class(pedGood[["id"]])

Run the code above in your browser using DataLab