--- title: "Example Usage : Custom F & MinMax Matrices" output: rmarkdown::html_vignette: tabset: true bibliography: references.bib vignette: > %\VignetteIndexEntry{Custom F Matrices} %\VignetteEncoding{UTF-8} %\VignetteEngine{knitr::rmarkdown} editor_options: chunk_output_type: console --- Phytoclass uses three input matrices: * `S` : The pigment values from field samples. * `F` : Defines which pigments are present in each taxa. * `min_max` : Specifies limits of taxa contributions for each pigment. The `F` and `min_max` matrices built into phytoclass are designed for general use. Specifying maxtrices tailored to a specific study region can improve accuracy of results. In this example we provide an `F` and `min_max` matrices which have been derived from a standard deviation calculation on pigment-to-chlorophyll ratios found in literature about the Southern Ocean. ```{r setup} library(phytoclass) library(here) ``` ```{R} # Load the sample matrix from a file # If your file does not contain sample names (e.g., Sample_1, Sample_2), you may omit `row.names = 1` # In that case, do: S_matrix <- read.csv(here("vignettes/custom-example-S.csv")) S_matrix <- read.csv(here("vignettes/custom-example-S.csv"), row.names = 1) ``` ```{R} # pigment-taxa occurrence matrix (specific to an oceanographic region) F_matrix <- read.csv(here("vignettes/custom-example-F.csv")) ``` ```{R} #| code-summary: clean up the F matrix # === remove numeric rownames introduced by read.csv if (all(grepl("^[0-9]+$", rownames(F_matrix)))) { print("dropping unneeded numeric index") # Set the first column as row names rownames(F_matrix) <- F_matrix[[1]] # Remove the first column F_matrix <- F_matrix[, -1] } ``` ```{R} min_max_matrix <- read.csv(here("vignettes/custom-example-min_max-southern_ocean.csv")) ``` ```{R} #| code-summary: clean up the min_max matrix # === remove numeric rownames introduced by read.csv if (all(grepl("^[0-9]+$", rownames(min_max_matrix)))) { print("dropping unneeded numeric index") # Set the first column as row names rownames(min_max_matrix) <- min_max_matrix[[1]] # Remove the first column min_max_matrix <- min_max_matrix[, -1] } ``` ```{R} phytoclass::simulated_annealing( S_matrix, Fmat = F_matrix, user_defined_min_max = min_max_matrix, verbose = FALSE ) ```