pretty_df: Make a data frame looks a bit pretty

Description Usage Arguments Value Examples

Description

This function standarize a data frame converting factors to characters, setting to lowercase the column names.

Usage

1
2
3
pretty_df(df, to.lower.df.names = TRUE, factor.to.string = TRUE,
  replace.num.na.with = NULL, replace.chr.na.with = NULL,
  trim.chr.vars = TRUE)

Arguments

df

A data frame

to.lower.df.names

df' names to lower?

factor.to.string

Factor to string?

replace.num.na.with

Value to replace NA when there are NAs in a numeric variables

replace.chr.na.with

Value to replace NA when there are NAs in a character variables

trim.chr.vars

Trim character vars=

Value

The same df with tbl_df class, lower names.

Examples

1
2
3
4
5
6
7
8
9
df <- data.frame(leTters = LETTERS[1:10], AA = rnorm(10), leTTers2 = letters[1:10])

df[c(1, 4),2] <- NA
df[c(2, 5),1] <- NA

str(df)
str(pretty_df(df))
pretty_df(df, replace.num.na.with = 0)
pretty_df(df, replace.chr.na.with = "no data")

jbkunst/riskr documentation built on May 18, 2019, 7 p.m.