knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The universal data structure we're going to use is:
abundance
(required)covariates
(optional)metadata
(required)If both abundance
and covariates
are present in the list, then the two data.frames must have the same number of rows.
In the abundance
data.frame:
Here, the common usage is for each column to be a species or taxon, and each row to be an observed sample. In other words, each column is a time series, with the rows sorted such that time advances down (higher row indices correspond to later times).
In the covariates
data.frame:
The number of rows should match that of abundance
, and rows of covariates
should line up with abundance
(either sampled simultaneously or concurrently). Common covariates are date and time, temperature, treatments, etc.
In the metadata
list:
is_community
entry, which indicates whether the time series in abundance
can be treated as components of a community with interactions and/or shared drivers in some waycitation
entry that is a vector of text values for the reference to the dataset. There can be multiple values (e.g. in the case of a specific dataset pulled from a larger database).location
entry, it must contain at least a latitude
and longitude
value (in decimal form). location
itself can be a data.frame or vector (that has names)timename
entry, it refers to a column in the covariates
data.frame that gives a time index for the datatidyr::full_seq
, along with a "period" entry (using 1 if missing) will produce the appropriate equi-timed spacingperiod
entry, it must be compatible with tidyr::full_seq
and the timename
variable described above.species_table
entry, it must have an id
column that includes all the column names in abundances
. This is intended to provide more information about the different variables in abundances
.Here is an example of a correctly formatted dataset with covariates and metadata:
library(MATSS) data(dragons) str(dragons)
We can view the abundance and covariates tables side by side:
knitr::kable(dragons[c("abundance", "covariates")])
We also provide a function for checking whether the data is formatted correctly:
check_data_format(dragons)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.