% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils-data.R
\name{icc_preprocess_data}
\alias{icc_preprocess_data}
\title{Preprocess and Validate Data for ICC Analysis}
\usage{
icc_preprocess_data(data, na.rm = TRUE)
}
\arguments{
\item{data}{A data frame or matrix. Rows represent subjects, columns represent raters/
repeated measurements. Must contain only numeric values.}

\item{na.rm}{Logical. Default is \code{TRUE}. If \code{TRUE}, remove rows with
missing values; if \code{FALSE}, retain missing values and return a warning.}
}
\value{
A named list containing:
\describe{
  \item{data_matrix}{Numeric matrix. Standardized numeric matrix (no missing values
    if \code{na.rm = TRUE}).}
  \item{n}{Integer. Number of valid subjects (rows).}
  \item{k}{Integer. Number of raters/repeated measurements (columns).}
  \item{warning_msg}{Character or \code{NULL}. Warning message for missing values,
    \code{NULL} if no missing values.}
  \item{error_msg}{Character or \code{NULL}. Error message for invalid data,
    \code{NULL} if data is valid.}
}
}
\description{
Performs standardized data cleaning, format conversion, and legality validation
for raw input data. Provides a unified valid data input for all ICC calculation
functions to avoid repetitive validation code.
}
\examples{
# Preprocess the built-in example dataset
data(icc_data)
processed <- icc_preprocess_data(icc_data)
str(processed)
}
\keyword{utilities}
