Documentation for R workflow refactor
Purpose
This provides an overview of the use of the trends RProj to prepare 20-year line plots of estimated moisture by pixel.
Directory
#| echo: false
dir()The files are used by the RStudio program to identify the project, set options, record history, and specify items to be excluded from versioning.
The directories contain
data received and used to conduct analysis; no changes are made to these files docs this HTML file and the source Quarto file and other documentation, notes and textural material img output plot files obj data objects derived from files in the data directory through scripts in the R directory
RscriptsScripts in the
Rdirectory
#| echo: false
dir(here::here("R"))- libr.R loads the libraries used
- func.R loads custom functions used
- cons.R loads constants
- prep.R loads objects used in the analysis
- setup.R loads the scripts above
- main.R performs the plotting
Functions
- assemble_trends
> takes the observations for a pixel, combines it with vector of years into a tsibble object, make uniform the variable names and derives STL decomposition trend
- conform_names
> convenience function to use the identical variable name for each pixel as it is called in order
- curtail
- convenience function to remove last element of a vector
- get_dcmp
> creates abn STL model
- get_means
> finds the 20-year mean of trend values for a pixel
- get_trend
> extracts select components from an STL model
- make_line
> create a geom_line object for the trend component of each year in a pixel
- tally_means
> to apply get_mean to an iteration of pixels
Running Code
When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
#| echo: false
1 + 1You can add options to executable code like this
#| echo: false
2 * 2The echo: false option disables the printing of code (only output is displayed).