1 Introduction

This worksheet provides guidance on how to prepare for the SEOSAW carbon dynamics workshop. The code chunks are all written in R.

This workshop assumes that you already know how to code in R.

In addition to a version of R, you should also have some kind of spreadsheet programme to visualise tabular data, and a web browser to download the workshop materials.

You can find this worksheet and other materials for the workshop in the Sharepoint folder.

2 Installing R

If you don’t already have R installed on your computer, you should go to https://www.r-project.org/ and install the latest version for you operating system.

It is recommended to also install RStudio, which provides a user-friendly development environment for R code. Go to https://posit.co/downloads/ and install the latest version for your operating system.

3 Check R version

The examples used in the workshop assume you are running a recent version of R. You must have R version 3.5.0 or above installed on your computer. You can check the version of R using:

R.Version()$version.string
## [1] "R version 4.2.3 (2023-03-15)"

4 Install packages

We will use a number of different R packages during the workshop. You can install packages using install.packages("<pkg>"). You should have these packages installed:

Additionally, there are some packages which are not available on CRAN. These packages must be installed directly from their development repositories.

remotes::install_bitbucket("miombo/seosaw/seosawr/seosawr")
remotes::install_github("johngodlee/ProdVital")
remotes::install_github("umr-amap/BIOMASS")

The {seosawr} package contains various functions used to clean and analyse data from the SEOSAW dataset. In the SEOSAW office, we use the {seosawr} package to check new data before it is assimilated into the database.

The {ProdVital} package contains functions for estimating growth rates, rates of productivity, loss, recruitment and mortality, using SEOSAW data.

The {BIOMASS} package is used to calculate estimates of woody biomass, and is very widely used. The BIOMASS package used to be on CRAN, but has since been removed.

If you have trouble installing the {seosawr} and {ProdVital} packages, anywhere the package is loaded (e.g. library(seosawr)) you can instead load the relevant functions from those packages from the R scipts in this repository:

source("./rscripts/ProdVital_fn.R")
source("./rscripts/seosawr_fn.R")

5 The SEOSAW dataset

The SEOSAW dataset is comprised of two main tables, “plots”, and “stems”. These tables are linked by two columns plot_id (ID of the plot) and census_date (date of the census). The plots table contains one row per census per plot. The stems table contains one row per measurement per stem.

Key columns in the stems table:

Here is an example of the stems stable:

Key columns in the plots table:

Here is an example of the plots table:

You can see more information about the columns in each of these tables by reading the “plot_columns.csv” and “stem_columns.csv” files in the Sharepoint folder.

6 Data requirements

For your data to be used in this workshop it must adhere to certain conditions. Unfortunately we don’t have time to clean and reformat new datasets.

Your data must: