tidyup_df: Round numeric columns and replace NA/NaN values by blank

View source: R/tidyup_df.R

tidyup_dfR Documentation

Round numeric columns and replace NA/NaN values by blank

Description

Identifies columns that can be coerced to numeric in a data frame, transforms these columns to numeric and round them to the specified digits. It also replaces NA and NaNs values by blank.

Usage

  tidyup_df(df = c(), digits = 3)

Arguments

df

Data frame

digits

Integer indicating the number of decimal places (round) or significant digits (signif) to be used

Value

Data frame with all possible columns as numeric and rounded to the specified number of digits

Author(s)

Jairo H Migueles

Examples

  # Test data frame
  df = data.frame(a = c("a", "b"), b = as.character(c(1.543218, 8.216856483)))
  tidyup_df(df = df, digits = 3)

GGIR documentation built on Oct. 1, 2022, 5:05 p.m.