% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/globals.R
\name{hm_normalize}
\alias{hm_normalize}
\title{Normalise marker columns in a data frame}
\usage{
hm_normalize(
  data,
  cols = NULL,
  method = c("z", "inverse", "range", "robust"),
  skip_cols = NULL,
  ...
)
}
\arguments{
\item{data}{A data frame (or tibble) containing marker columns to normalise.}

\item{cols}{Character vector of column names to normalise.  If \code{NULL}
(default), \strong{all numeric columns} in \code{data} are normalised.}

\item{method}{One of \code{c("z","inverse","range","robust")}.  Passed directly to
\code{\link[=normalize_vec]{normalize_vec()}}:
\describe{
\item{\code{"z"}}{z-score (mean 0, sd 1).}
\item{\code{"inverse"}}{Rank-based inverse-normal transform (Rankit; default).}
\item{\code{"range"}}{Min-max scaling to \code{feature_range} (default \verb{[0, 1]}).}
\item{\code{"robust"}}{Median/MAD scaling.}
}}

\item{skip_cols}{Character vector of column names to leave untouched even if
they are numeric (e.g. \code{c("age", "BMI")}).  Ignored when \code{cols} is
explicitly supplied.}

\item{...}{Additional arguments forwarded to \code{\link[=normalize_vec]{normalize_vec()}} (e.g.
\code{feature_range}, \code{invnorm_denominator}, \code{ties}).}
}
\value{
The input \code{data} with the selected columns replaced by their
normalised values.  Class (tibble, data.frame, etc.) is preserved.
}
\description{
A convenience wrapper around \code{\link[=normalize_vec]{normalize_vec()}} that applies a normalisation
method to every selected numeric column in a data frame and returns the
modified data frame. The most common use-case is to normalise the output of
any HealthMarkers function — especially domain functions such as
\code{glycemic_markers()}, \code{lipid_markers()}, or \code{renal_markers()} whose internal
\code{normalize} argument currently has no effect.
}
\examples{
# Build a tiny data frame with pre-computed marker columns
df <- data.frame(
  age    = c(45, 52, 61),
  HOMA_IR = c(1.2, 3.4, 2.1),
  TyG     = c(8.1, 9.0, 8.6),
  NLR     = c(2.1, 3.5, 1.8)
)

marker_cols <- c("HOMA_IR", "TyG", "NLR")

# z-score normalise marker columns only
hm_normalize(df, cols = marker_cols, method = "z")

# Inverse-normal transform, leaving age untouched
hm_normalize(df, method = "inverse", skip_cols = "age")
}
\seealso{
\code{\link[=normalize_vec]{normalize_vec()}} for single-vector normalisation.
}
