toCharacter: Force dataframe columns to character

Description Usage Arguments Details Value

View source: R/toCharacter.R

Description

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

Usage

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

Arguments

df

a dataframe where the first three columns can be coerced to character.

headers

character vector with the columns to be converted to character class. Defaults to c("id", "sire", "dam")/

Details

NOTE: Function was created to deal with a display bug in xtables (used by Shiny) The bug causes Date columns to be displayed improperly Shiny also displays all Numbers (including integers) with 2 decimal places Comment by R. Mark Sharp - this is just one way to modify the number of digits displayed. library(DT)

set.seed(323) data.frame(x=runif(10), y=rnorm(10), z=rpois(10, 1)) datatable() formatRound(columns=c('x', 'y'), digits=3)

Value

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


rmsharp/nprcmanager documentation built on Jan. 22, 2019, 7:03 a.m.