to_df: Change the formatting of data in column(s) of a dataframe to...

Description Usage Arguments Value Examples

View source: R/nicenumberrr.R

Description

Change the formatting of data in column(s) of a dataframe to either human readable or numeric

Usage

1
2
3
4
5
6
7
8
to_df(
  df,
  col_names = NULL,
  transform_type = "human",
  family = "number",
  errors = "raise",
  ...
)

Arguments

df

dataframe, dataframe to apply formatting

col_names

str or vector, column names to apply formatting (default is all columns)

transform_type

str, type of transformation (e.g. human, num)

family

str, family of suffix, numeric or filesize

errors

'raise', 'coerce', default 'raise' If 'raise', then invalid parsing will raise an exception. If 'coerce', then invalid parsing will return NA.

...

Additional formatting arguments separated by commas, e.g. 'prec'. See full documentation for more details.

Value

dataframe with formatting applied

Examples

1
2
df <- data.frame(A = c(1000, 10000), B = c(1000000, 100000))
to_df(df, col_names = c("A", "B"), transform_type = "human")

UBC-MDS/NiceNumbERRR documentation built on March 30, 2021, 12:02 p.m.