Learn R Programming

AgeBandDecomposition (version 1.0.1)

TRW_readExcel: TRW_readExcel

Description

This function supports the first step of data import from an Excel file and arranges the dataset properly for ABD analysis.

Usage

TRW_readExcel(path, sheet, ageBands, limitFirst20y, verbose = TRUE)

Value

A list of two objects. The first object is a tibble representing the imported dataset in long format. In this tibble the last two columns are an identification number (id_by_years) and two grouping variables (age_class and ageBands). The second object in the list is a lookup table (tibble), useful for further steps.

Arguments

path

Path to the xls/xlsx file. The Excel file must be compiled following the instructions of the package at the git-page https://gitlab.com/Puletti/agebanddecomposition_rpackage. See also Details here following.

sheet

Sheet to read. Either a string (the name of a sheet), or an integer (the position of the sheet). Ignored if the sheet is specified via range. If neither argument specifies the sheet, defaults to the first sheet.

ageBands

character. Setting the age band window. It must be set to '1010' if all the age classes have the same size (10 years). It must be '1020' if the age classes have different sizes: 10 years till 100 and then 20 years size.

limitFirst20y

logical. This argument removes the first 20 years from each tree. Default is FALSE (no data filtering).

verbose

logical. If TRUE, prints additional information during import.

Details

The provided Excel .xlsx file contains tree-ring width (TRW) chronologies organized by year. Each column represents an individual tree (e.g., tree01, tree02, tree03, etc.), with rows corresponding to calendar years. Missing values within the ring-width series (e.g., due to measurement gaps or broken sections) and the estimated number of rings to the pith for incomplete cores must be explicitly coded as -999.

An example .xlsx file formatted accordingly is available on the package's GitLab page.

https://gitlab.com/Puletti/agebanddecomposition_rpackage

This example can be used to test the functions or as a template for preparing your own data.

See Also

stdTRW, ABD

Other ABD functions: ABD(), stdTRW()

Examples

Run this code
# Download the 'ABD_example.xlsx' file from the GitLab page of the package
package_gitlab_site <- 'https://gitlab.com/Puletti/agebanddecomposition_rpackage'
xls_url <- "/-/raw/main/studio/dati/TRW_example.xlsx"
url <- paste0(package_gitlab_site,xls_url)

tmpfile <- tempfile(fileext = ".xlsx")
download.file(url,
              tmpfile,
              mode = "wb")

inTRW_example <- TRW_readExcel(tmpfile, sheet = "Example", ageBands = '1010', limitFirst20y = FALSE)
inTRW_example

Run the code above in your browser using DataLab