CharAnalysis: Run the full CharAnalysis pipeline

View source: R/CharAnalysis.R

CharAnalysisR Documentation

Run the full CharAnalysis pipeline

Description

Top-level wrapper that calls each analytical stage in sequence and returns all intermediate and final results as a single named list.

Usage

CharAnalysis(file_name = NULL)

Arguments

file_name

Path to the *_charParams.csv (or .xlsx) parameter file. If omitted (or NULL), a system file-picker dialog is opened so you can navigate to the file interactively – matching the MATLAB behaviour of typing CharAnalysis with no argument. In non-interactive sessions (e.g. scripts, batch jobs) the argument is required and an error is thrown if it is missing.

Value

Named list with the following elements:

charcoal

List of raw and resampled series. After Phase 2: includes accIS (smoothed background) and peak (C_peak, either residuals or ratios). After Phase 3: also includes charPeaks ([N \times T] binary peak matrix), charPeaksThresh, peaksTotal, and threshFRI. After Phase 4: also includes peakInsig, peakMagnitude, smoothedFireFrequ, peaksFrequ.

pretreatment

Pretreatment parameter list (possibly updated by [char_pretreatment()] – e.g. yrInterp auto-set, zoneDiv end-value corrected).

smoothing

Smoothing parameter list.

peak_analysis

Peak-analysis parameter list.

results

Results / output parameter list.

site

Character string: site name.

gap_in

Integer matrix (nGaps x 2) of missing-value gap indices.

char_thresh

Threshold list returned by [char_thresh_global()] or [char_thresh_local()]. Contains pos, neg, SNI, GOF, and (after Phase 3) minCountP – the [N \times T] matrix of Shuie-Bain p-values.

post

Post-processing list from [char_post_process()]: FRI series, smoothed FRI curve, per-zone Weibull statistics, and the assembled char_results output matrix (N \times 33).

char_results

Numeric matrix (N \times 33) matching the MATLAB charResults output exactly (alias of post$char_results).

See Also

[char_parameters()], [char_validate_params()], [char_pretreatment()], [char_smooth()], [char_thresh_global()], [char_thresh_local()], [char_peak_id()], [char_post_process()]

Examples


  # Run the full pipeline on the bundled example dataset:
  params_file <- system.file("validation", "CO_charParams.csv",
                             package = "CharAnalysis")
  out <- CharAnalysis(params_file)
  # Phase 2 outputs
  head(data.frame(ageTop_i   = out$charcoal$ybpI,
                  charAcc_i  = out$charcoal$accI,
                  charBkg_i  = out$charcoal$accIS,
                  charPeak_i = out$charcoal$peak))
  # Phase 3 outputs
  sum(out$charcoal$charPeaks[, ncol(out$charcoal$charPeaks)])


CharAnalysis documentation built on May 3, 2026, 5:06 p.m.