Using the data

There are three ways to get Carob standardized data:

  1. Direct download from the Download page (as .zip archives of CSV files, or as .xlsx workbooks for individual groups). These downloads include datasets with a Creative Commons (CC) or ETALAB license.

  2. In R with the caramba package (carob-data/caramba), which downloads CC-licensed data directly and can also download and process non-CC datasets from their original sources on the fly.

  3. Compile locally by cloning the Carob repository and running carobiner::make_carob() (see Compile). This gives you all datasets, including those whose licenses do not allow redistribution.

Getting data in R with caramba

Install caramba from GitHub:

remotes::install_github("carob-data/caramba")

To download and read a compiled CC-licensed group:

x <- caramba::carob_collection("agronomy")
names(x)

To download one or more individual datasets by URI (or dataset_id):

x <- caramba::carob_dataset("doi:10.7910/DVN/LTS278")
names(x)
head(x$wide)
x$meta

If a dataset does not have a CC/ETALAB license (or if you pass from_source = TRUE), carob_dataset() downloads the raw files from the original repository and runs the Carob script locally. Pass path to keep downloaded files across sessions, and read = FALSE if you only want the file paths.

Structure of the compiled files

A downloaded .zip archive for a group contains several CSV files that work together:

  • carob_<group>_latest-cc.csv: the main (“wide”) data table. Each row is an experimental unit (plot, treatment mean, or survey household) and each column is a terminag variable in standard units.

  • carob_<group>_latest_metadata-cc.csv: one row per original dataset, with dataset_id, uri, authors, title, license, data_citation, data_type, treatment_vars, response_vars, publication, and data_organization.

  • carob_<group>_latest_long-cc.csv (when present): repeated measurements over time or multi-row sub-observations that cannot be stored in a single wide row.

  • carob_<group>_latest_terms.csv: variable names, data types, units, and descriptions from the terminag vocabulary.

  • carob_<group>_latest_warnings-cc.csv (when present): automated compliance messages and data quality warnings recorded when the scripts were run.

Excel downloads (.xlsx) contain the same tables as separate sheets (sources, terms, data, and warnings).

Use dataset_id to join the data with the metadata table, and dataset_id together with record_id (or plot_id / trial_id / hhid) to join wide and long tables:

d <- read.csv("carob_agronomy_latest-cc.csv")
m <- read.csv("carob_agronomy_latest_metadata-cc.csv")

# inspect metadata for a subset of records
maize <- d[d$crop == "maize" & !is.na(d$yield), ]
meta_maize <- m[m$dataset_id %in% unique(maize$dataset_id), ]

Keep in mind that thematic groups are not mutually exclusive: for example, variety names also appear in agronomy, and fertilizer rates also appear in survey and varieties_*.

Licenses and citation

Each dataset in Carob retains its original license. Before using or redistributing data, check the license column in the metadata table for the datasets you actually use — in particular, check for non-commercial restrictions (-NC) and bespoke terms such as the CIMMYT license. Do not use a dataset in a way that violates its license.

When publishing work based on Carob data, you should cite both:

  1. The original datasets included in your analysis. Formatted citations are provided in the data_citation column of the metadata table (and associated papers, if any, in publication):

citations <- unique(meta_maize$data_citation)
writeLines(citations, "carob_sources.txt")
  1. The Carob project, noting the group(s) and date (or version) of the compilation you used, for example:

    Carob standardized agricultural research data (https://carob-data.org), compiled agronomy group, accessed <date>.