knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This is the code for part of the SDEF root data processing. Pre-processed
data is taken from data(SDEF_roots_pre_process)
and biomass is calculated
on a per-root basis. This document wasn't knit, it's mostly for archival purposes.
# Analyze root data, make table of 'site', 'date', 'depth_bin', 'biomass', # and standard deviation of depth_bina across site library(SDEF.analysis) data("SDEF_root_ash_weights") # Load ash weight data. data("SDEF_roots_pre_process") # Load preaggregated data data_root <- SDEF_roots_pre_process # Calculate biodensity/C density from root ashing data data_ash <- SDEF_root_ash_weights data_ash <- SDEF.analysis::CalculateCarbonContent(data = data_ash) # Biodensity needs a veg type column: veg_type <- rep("shrub", nrow(data_root)) veg_type[which(data_root[["site"]] == "grass")] <- "grass" data_root <- data.frame(veg_type, data_root) # 'Site' also needs to be 'plot' colnames(data_root)[which(colnames(data_root) == "site")] <- "plot" # Calculate root biodensity on a per-root basis # Frame height 6.75mm, frame width 9.0 mm data_root <- SDEF.analysis::CalculateBioDensity(data = data_root, frame.size = c(6.75, 9.0, 0.78), scale = "root") # Put the df back to how it was... data_root <- data_root[, -which(colnames(data_root) == "veg_type")] colnames(data_root)[which(colnames(data_root) == "plot")] <- "site" # Drop frame, root, real_depth, and biovolume drops <- c("frame", "root", "real_depth", "biovolume") data_root <- data_root[, -which(colnames(data_root) %in% drops)] SDEF_roots_pre_aggregation <- data_root #devtools::use_data(SDEF_roots_pre_aggregation)
End script!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.