R/scaling-and-normalization.R

Defines functions rescale_df

#' @export
#'
rescale_df <- function(df, to = c(0.01, 1), verbose = TRUE, with.time = TRUE){

  give_feedback(msg = "Rescaling.", verbose = verbose, with.time = with.time)

  df <-
     dplyr::mutate(
       .data = df,
       dplyr::across(
         .cols = where(base::is.numeric),
         .fns = ~ scales::rescale(x = .x, to = to)
       )
     )

  give_feedback(msg = "Done.", verbose = verbose, with.time = with.time)

  return(df)

}
kueckelj/confuns documentation built on July 4, 2024, 4:53 p.m.