knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Twigs are the smallest above ground woody component of a tree. Twigs are responsible for supporting the delicate tissues needed to grow leaves and protect the buds during the dormant season. Because twig measurements are the basis for the Real Twig method, and publicly available databases of twigs are limited, we present a database of twig measurements for a wide range of tree genera and species.
You can install the package directly from CRAN:
install.packages("rTwig")
Or the latest development version from GitHub:
devtools::install_github("https://github.com/aidanmorales/rTwig")
The first step is to load the rTwig package.
library(rTwig) # Useful packages library(dplyr) library(ggplot2)
The twig database is built directly into rTwig and can be called as follows:
# If the rTwig library has been loaded
twigs
# If rTwig hasn't been loaded, but just the twigs are needed rTwig::twigs
The database is broken into 7 different columns. scientific_name is the specific epithet. Genus spp. is the average of all of the species in the genus. radius_mm is the twig radius in millimeters. For each species, n is the number of unique twig samples taken, min is the minimum twig radius, max is the max twig radius, std is the standard deviation, and cv is the coefficient of variation.
Let's see the breakdown of species.
unique(twigs$scientific_name)
Let's visualize some of the twig data!
# Lets look at a subset of oak species twigs %>% filter(grepl("Quercus", scientific_name)) %>% ggplot(aes(x = scientific_name, y = radius_mm, color = scientific_name)) + geom_point(aes(size = n)) + geom_errorbar(aes(ymax = max, ymin = min)) + coord_flip() + labs( title = "Quercus Twig Radii", x = "", y = "Twig Radius (mm)", color = "Species", size = "Sample Size" ) + scale_x_discrete(limits = rev) + theme_classic()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.