% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sweat_markers.R
\name{sweat_markers}
\alias{sweat_markers}
\title{Calculate sweat-based ionic & metabolic markers}
\usage{
sweat_markers(
  data,
  col_map = NULL,
  verbose = TRUE,
  na_action = c("keep", "omit", "error"),
  na_warn_prop = 0.2
)
}
\arguments{
\item{data}{A data.frame or tibble containing sweat assay and anthropometrics.}

\item{col_map}{Named list mapping required inputs (defaults assume same names):
\itemize{
\item sweat_chloride, sweat_Na, sweat_K, sweat_lactate,
weight_before, weight_after, duration, body_surface_area
}}

\item{verbose}{Logical; if \code{TRUE}, prints progress messages and a completion summary.}

\item{na_action}{One of \code{c("keep","omit","error")} for handling missing values in required inputs. Default "keep".}

\item{na_warn_prop}{Proportion \eqn{[0,1]} to trigger high-missingness diagnostics for required inputs (debug level). Default 0.2.}
}
\value{
A tibble with columns:
\code{sweat_chloride}, \code{Na_K_ratio}, \code{sweat_lactate}, \code{sweat_rate}
}
\description{
Computes:
\itemize{
\item sweat_chloride (mmol/L)
\item Na_K_ratio     (sweat Na+/K+)
\item sweat_lactate  (mmol/L)
\item sweat_rate     (L/m^2/h) from body mass loss per hour per m^2
}
}
\details{
Inputs are validated, missingness handled via \code{na_action}, safe divisions
are used to avoid Inf/NaN, and an optional extremes scan/cap is available.

Expected units:
\itemize{
\item sweat_chloride, sweat_Na, sweat_K: mmol/L
\item sweat_lactate: mmol/L
\item weight_before, weight_after: kg
\item duration: hours
\item body_surface_area: m^2
}
}
\note{
\code{sweat_chloride} and \code{sweat_lactate} are \strong{pass-through} columns; no formula
is applied. \code{Na_K_ratio} is a simple Na/K division. \code{sweat_rate} uses the
mass-loss method: (weight_before - weight_after) / duration / body_surface_area
(units: L/m\ifelse{html}{\out{&sup2;}}{^2}/h; assumes 1 kg \eqn{\approx} 1 L).
Dill & Costill 1974 describes haematocrit-based blood-volume change, not sweat
rate directly; cited here as background context only.
}
\examples{
df <- tibble::tibble(
  sweat_chloride    = 45,
  sweat_Na          = 55,
  sweat_K           = 5,
  sweat_lactate     = 4.8,
  weight_before     = 70.0,
  weight_after      = 69.5,
  duration          = 1.0,
  body_surface_area = 1.9
)
sweat_markers(df)

}
\references{
\insertRef{gibson1959sweat}{HealthMarkers} (pilocarpine sweat chloride test origin; background)
\insertRef{dill1974dehydration}{HealthMarkers} (dehydration and fluid loss context; background)
\insertRef{farrell2017cf}{HealthMarkers} (CF diagnostic sweat chloride cutoffs; background)
\insertRef{sawka2015hypo}{HealthMarkers} (sweat rate and hypohydration context; background)
}
