R/rc_rounddf.R

Defines functions rounddf

Documented in rounddf

#' Round all numeric fields in a data frame
#' 
#' @param df A data frame to round
#' @param roundDigits Number of digits to round to
#' @return A rounded data frame

rounddf <- function(df, roundDigits) {
  
  df[sapply(df, is.numeric)] <- lapply(df[sapply(df, is.numeric)], round, roundDigits)
  return(df)
}
eauleaf/dataReviewR documentation built on Dec. 20, 2021, 3:11 a.m.