% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/char_parameters.R
\name{char_parameters}
\alias{char_parameters}
\title{Read CharAnalysis parameter and data files}
\usage{
char_parameters(file_name)
}
\arguments{
\item{file_name}{Path to the \code{*_charParams.csv} (or \code{.xlsx})
parameter file.}
}
\value{
A named list with elements:
  \describe{
    \item{char_data}{Numeric matrix (n_samples x 6+): cmTop, cmBot, ageTop,
      ageBot, charVol, charCount.}
    \item{pretreatment}{List: \code{zoneDiv}, \code{yrInterp},
      \code{transform}.}
    \item{smoothing}{List: \code{method}, \code{yr}.}
    \item{peak_analysis}{List: \code{cPeak}, \code{threshType},
      \code{threshMethod}, \code{threshValues}, \code{minCountP},
      \code{peakFrequ}, \code{bkgSens}.}
    \item{results}{List: \code{saveFigures}, \code{save},
      \code{allFigures}.}
    \item{site}{Character string: site name derived from the filename stem.}
  }
}
\description{
Reads the \code{*_charParams.csv} (or \code{.xlsx}) parameter file and the
companion charcoal data file, then unpacks all analysis parameters into
named lists that mirror the MATLAB struct layout.
}
\details{
**CSV convention** (unchanged from MATLAB v1.1): the parameter file is
  named \code{<site>_charParams.csv} and the companion data file is
  \code{<site>_charData.csv} in the same directory.  The site name is the
  basename with the trailing \code{_charParams.csv} (15 characters) removed,
  mirroring MATLAB's \code{fileName(1:end-15)} idiom.

  **Parameter vector layout**: column 3 ("Parameters") of the CSV, rows
  2-26 (25 data rows after the header), maps to positions 1-25 of the
  internal \code{charParams} vector exactly as in the MATLAB codebase.
  Unused \code{zoneDiv} slots are filled with \code{-9999} in the CSV
  (sentinel) or \code{NaN} in Excel; both are stripped before the list is
  returned.
}
\examples{
# Read a bundled example parameter file:
params_file <- system.file("validation", "CO_charParams.csv",
                           package = "CharAnalysis")
p <- char_parameters(params_file)
p$pretreatment$yrInterp   # interpolation interval (yr)
p$smoothing$method        # smoothing method index (1-5)
}
\seealso{
[char_validate_params()], [char_pretreatment()], [CharAnalysis()]
}
