R/format_numeric.R

Defines functions format_numeric

Documented in format_numeric

#' helper function to format output to csvs
#'
#' @export
#' @param x dataframe to format
#' @param ... additional arguments to format
#' @details base::format does not appear to produce a data.frame so it can't be used with write_tsv. I typically use this with sci=FALSE to turn off scientific notation but it can also control significant digits, decimal places etc. see `format` for options.


format_numeric <- function(x,...) {
	numeric_cols <- vapply(x, is.numeric, logical(1))
	x[numeric_cols] <- lapply(x[numeric_cols], format, ...)
	x
}
hoargroup/stationsweRegression documentation built on Feb. 4, 2024, 7:21 a.m.