View source: R/char_write_results.R
| char_write_results | R Documentation |
Writes the N \times 33 char_results matrix (assembled by
[char_post_process()]) to a CSV file whose column headers and numeric
format match the MATLAB CharAnalysis v2.0 *_charResults.csv output
exactly.
char_write_results(char_results, site, out_dir, digits = 7L)
char_results |
Numeric matrix ( |
site |
Character string: site name, used to build the
output filename ( |
out_dir |
Directory in which to create the file. Required;
no default. Created if it does not exist. Use |
digits |
Number of significant digits for numeric output.
Default 7, matching MATLAB's |
## Column order and headers
Columns follow the MATLAB charResults layout:
cm Top_i (cm)
age Top_i (yr BP)
char Count_i (#)
char Vol_i (cm3)
char Con_i (# cm-3)
char Acc_i (# cm-2 yr-1)
charBkg (# cm-2 yr-1)
char Peak (# cm-2 yr-1)
thresh 1 (# cm-2 yr-1)
thresh 2 (# cm-2 yr-1)
thresh 3 (# cm-2 yr-1)
thresh FinalPos (# cm-2 yr-1)
thresh FinalNeg (# cm-2 yr-1)
SNI (index)
thresh GOF (p-val)
peaks 1
peaks 2
peaks 3
peaks Final
peaks Insig.
peak Mag (# cm-2 peak-1)
smPeak Frequ (peaks 1ka-1)
smFRIs (yr fire-1)
nFRIs (#)
mFRI (yr fire-1)
mFRI_uCI (yr fire-1)
mFRI_lCI (yr fire-1)
WBLb (yr)
WBLb_uCI (yr)
WBLb_lCI (yr)
WBLc (unitless)
WBLc_uCI (unitless)
WBLc_lCI (unitless)
## NA / empty handling
NA values are written as empty fields (no quotes), matching
MATLAB's blank-cell convention. This applies to:
smFRIs rows beyond the smoothed-FRI coverage window;
zone-statistics columns (24-33) for rows beyond the last zone;
any column not computed for a given run configuration.
## CI column convention
MATLAB stores bootstrap CIs as [quantile(2.5%), quantile(97.5%)]
in the columns labelled uCI / lCI respectively (i.e.
uCI = lower bound, lCI = upper bound – MATLAB's own
labelling is inverted). The R output follows the same convention so that
column indices are identical to the MATLAB reference file.
Invisibly returns the full path to the file written.
[char_post_process()], [CharAnalysis()]
# Run the pipeline on the bundled example and write results to tempdir:
params_file <- system.file("validation", "CO_charParams.csv",
package = "CharAnalysis")
out <- CharAnalysis(params_file)
char_write_results(out$char_results, out$site,
out_dir = tempdir())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.