---
title: "Introduction"
output:
html_document:
theme: flatly
highlight: tango
toc: TRUE
toc_depth: 4 # Define the depth of the TOC (increase as needed)
toc_float:
collapsed: TRUE # Whether the TOC starts collapsed
smooth_scroll: TRUE # Smooth scrolling when a TOC entry is clicked
fontsize: 12pt # Set font size
linkcolor: blue # Hyperlink color (for PDF output)
vignette: >
%\VignetteIndexEntry{Introduction}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup_general, include = FALSE}
knitr::opts_chunk$set(
echo = TRUE,
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = "#>"
)
```
```{r setup_lib, include=FALSE}
if (!requireNamespace("htmltools", quietly = TRUE)) {
stop("Package 'htmltools' is required to run this function. Please install it.")
}
```
## Introduction
This vignette demonstrates the main workflow of the **growthTrendR** package for manipulating, analyzing, and visualizing tree-ring data and model performance.
The workflow includes:
- Data loading, to import raw measurements and prepare them for analysis.
- Data processing, which organizes and formats the data for subsequent steps.
- Quality assessment, ensuring the reliability and consistency of the measurements.
- Modeling, where growth trends and patterns are analyzed.
As illustrated in the following diagram, visual inspection is provided at each step to facilitate assessment of data quality and validation of results.
```{r workflow, echo = FALSE, results = 'asis', warning=FALSE, message=FALSE, out.width="80%", out.height="auto"}
# Path to the PNG inside the package
knitr::include_graphics("images/workflow_clean.png")
# Check existence
# Embed the image
```
------------------------------------------------------------------------
## Installation
The stable release of **growthTrendR** is available from CRAN, while the latest development version is available from the GitHub repository. The recommended GitHub installation method uses the `pak` package to automatically resolve and install package dependencies. An alternative manual installation approach is provided for users who encounter dependency or network-related issues.
### Install the CRAN release
```{r install-cran, eval=FALSE}
install.packages("growthTrendR")
```
### Method 1 (recommended): Install the latest GitHub version using `pak`
```{r install-pak, eval=FALSE}
# Install pak if needed
install.packages("pak")
# Recommended settings for slower network connections
options(
download.file.method = "libcurl",
url.method = "libcurl",
timeout = 3000
)
pak::pkg_install(
"CFS-treering/growthTrendR",
dependencies = c("Imports", "Suggests")
)
```
### Method 2 (alternative): Manually install dependencies
If some dependencies are not installed automatically, they can be installed manually before installing the GitHub version of **growthTrendR**.
```{r install-manual, eval=FALSE}
pkg.imports <- c(
"data.table", "stringr", "stats", "mgcv", "ggplot2", "nlme",
"patchwork", "terra", "sf", "raster", "furrr", "future",
"htmltools", "curl", "dplyr")
pkg.suggests <- c(
"knitr", "geosphere", "ggeffects", "ggforce", "gstat", "scales",
"purrr", "parallel", "MuMIn", "rmarkdown", "rstudioapi", "MASS",
"sp", "spdep", "magick", "gt", "kableExtra", "httr",
"gridExtra", "rnaturalearth")
install.packages(c(pkg.imports, pkg.suggests))
# Install growthTrendR from GitHub (latest version)
pak::pkg_install("CFS-treering/growthTrendR")
```