Skip to content

Commit 0a1b59b

Browse files
committed
add dataset doc
1 parent dce94e3 commit 0a1b59b

2 files changed

Lines changed: 226 additions & 0 deletions

File tree

R/betydata-package.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#' betydata: Public Data from the BETYdb Database
2+
#'
3+
#' Offline access to plant trait and yield data from BETYdb.
4+
#' Load datasets with `data(traitsview)`, `data(species)`, etc.
5+
#'
6+
#' @seealso [traitsview], [species], [sites], [variables], [pfts], [priors]
7+
#' @keywords internal
8+
"_PACKAGE"

R/data.R

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# Dataset documentation for betydata package
2+
3+
#' Traits and Yields from BETYdb
4+
#'
5+
#' A denormalized view combining plant trait measurements and crop yield data
6+
#' from the BETYdb database. This is the primary dataset for offline analysis.
7+
#'
8+
#' @format A data frame with 43,532 rows and 36 columns:
9+
#' \describe{
10+
#' \item{checked}{Data quality flag: 0 = unchecked, 1 = verified, -1 = flagged (excluded)}
11+
#' \item{result_type}{Type of measurement: "traits" or "yields"}
12+
#' \item{id}{Unique identifier for the trait or yield record}
13+
#' \item{citation_id}{Foreign key to citations table}
14+
#' \item{site_id}{Foreign key to sites table}
15+
#' \item{treatment_id}{Foreign key to treatments table}
16+
#' \item{sitename}{Name of the research site}
17+
#' \item{city}{City or region where site is located}
18+
#' \item{lat, lon}{Site coordinates (decimal degrees)}
19+
#' \item{scientificname}{Species scientific name (Genus species)}
20+
#' \item{commonname}{Species common name}
21+
#' \item{genus}{Taxonomic genus}
22+
#' \item{species_id}{Foreign key to species table}
23+
#' \item{cultivar_id}{Foreign key to cultivars table (may be NA)}
24+
#' \item{author}{Citation author(s)}
25+
#' \item{citation_year}{Year of publication}
26+
#' \item{treatment}{Experimental treatment name}
27+
#' \item{date}{Formatted measurement date (human-readable)}
28+
#' \item{time}{Time of measurement or confidence indicator}
29+
#' \item{raw_date}{Raw timestamp from database}
30+
#' \item{month, year}{Extracted month and year}
31+
#' \item{dateloc}{Date location confidence (1-9 scale)}
32+
#' \item{trait}{Variable/trait name (e.g. "SLA", "Vcmax", "Ayield")}
33+
#' \item{trait_description}{Description of the trait/variable}
34+
#' \item{mean}{Mean value of the measurement}
35+
#' \item{units}{Units of measurement}
36+
#' \item{n}{Sample size}
37+
#' \item{statname}{Type of uncertainty statistic (SE, SD, etc.)}
38+
#' \item{stat}{Value of the uncertainty statistic}
39+
#' \item{notes}{Additional notes}
40+
#' \item{access_level}{Data access level (4 = public)}
41+
#' \item{cultivar}{Cultivar name if applicable}
42+
#' \item{entity}{Entity name (for repeated measures)}
43+
#' \item{method_name}{Measurement method name}
44+
#' }
45+
#' @source \url{https://betydb.org}, exported from traits_and_yields_view
46+
#' @seealso [species], [sites], [variables], [citations]
47+
#' @examples
48+
#' head(traitsview)
49+
#'
50+
#' # Count by trait
51+
#' if (requireNamespace("dplyr", quietly = TRUE)) {
52+
#' dplyr::count(traitsview, trait, sort = TRUE)
53+
#' }
54+
"traitsview"
55+
56+
#' Species taxonomy from BETYdb
57+
#'
58+
#' Taxonomic information for plant species in BETYdb.
59+
#'
60+
#' @format A data frame with columns including:
61+
#' \describe{
62+
#' \item{id}{Species identifier}
63+
#' \item{spcd}{Species code}
64+
#' \item{genus}{Taxonomic genus}
65+
#' \item{species}{Specific epithet}
66+
#' \item{scientificname}{Full scientific name}
67+
#' \item{commonname}{Common name(s)}
68+
#' }
69+
#' @source \url{https://betydb.org}
70+
"species"
71+
72+
#' Research sites from BETYdb
73+
#'
74+
#' Geographic and metadata for research sites.
75+
#'
76+
#' @format A data frame with columns including:
77+
#' \describe{
78+
#' \item{id}{Site identifier}
79+
#' \item{sitename}{Site name}
80+
#' \item{city, state, country}{Location}
81+
#' \item{lat, lon}{Coordinates (decimal degrees)}
82+
#' \item{mat, map}{Mean annual temperature and precipitation}
83+
#' }
84+
#' @source \url{https://betydb.org}
85+
"sites"
86+
87+
#' Variable definitions from BETYdb
88+
#'
89+
#' Definitions and metadata for measured variables/traits.
90+
#'
91+
#' @format A data frame with columns including:
92+
#' \describe{
93+
#' \item{id}{Variable identifier}
94+
#' \item{name}{Variable name (e.g., "SLA", "Vcmax")}
95+
#' \item{description}{Full description}
96+
#' \item{units}{Standard units}
97+
#' \item{min, max}{Valid range}
98+
#' }
99+
#' @source \url{https://betydb.org}
100+
"variables"
101+
102+
#' Literature citations from BETYdb
103+
#'
104+
#' Bibliographic references for data sources.
105+
#'
106+
#' @format A data frame with columns including:
107+
#' \describe{
108+
#' \item{id}{Citation identifier}
109+
#' \item{author}{Author(s)}
110+
#' \item{year}{Publication year}
111+
#' \item{title}{Article/book title}
112+
#' \item{journal}{Journal name}
113+
#' \item{doi}{Digital Object Identifier}
114+
#' }
115+
#' @source \url{https://betydb.org}
116+
"citations"
117+
118+
#' Plant cultivars from BETYdb
119+
#' @format A data frame with cultivar information.
120+
#' @source \url{https://betydb.org}
121+
"cultivars"
122+
123+
#' Measurement methods from BETYdb
124+
#' @format A data frame with method descriptions.
125+
#' @source \url{https://betydb.org}
126+
"methods"
127+
128+
#' Experimental treatments from BETYdb
129+
#' @format A data frame with treatment definitions.
130+
#' @source \url{https://betydb.org}
131+
"treatments"
132+
133+
#' Plant Functional Types (PFTs) from BETYdb
134+
#'
135+
#' PFT definitions used for grouping species for modeling.
136+
#'
137+
#' @format A data frame with columns including:
138+
#' \describe{
139+
#' \item{id}{PFT identifier}
140+
#' \item{name}{PFT name (e.g. "temperate.deciduous")}
141+
#' \item{definition}{Full definition}
142+
#' }
143+
#' @source \url{https://betydb.org}
144+
#' @seealso [pfts_species], [pfts_priors]
145+
"pfts"
146+
147+
#' Prior distributions from BETYdb
148+
#'
149+
#' Prior probability distributions for Bayesian analysis.
150+
#'
151+
#' @format A data frame with columns including:
152+
#' \describe{
153+
#' \item{id}{Prior identifier}
154+
#' \item{variable_id}{Associated variable}
155+
#' \item{distn}{Distribution type (e.g. "norm", "gamma")}
156+
#' \item{parama, paramb, paramc}{Distribution parameters}
157+
#' }
158+
#' @source \url{https://betydb.org}
159+
#' @seealso [pfts_priors], [variables]
160+
"priors"
161+
162+
#' Management practices from BETYdb
163+
#' @format A data frame with management event data.
164+
#' @source \url{https://betydb.org}
165+
"managements"
166+
167+
#' Entities from BETYdb
168+
#' @format A data frame with entity (individual/plot) information.
169+
#' @source \url{https://betydb.org}
170+
"entities"
171+
172+
#' PFT-Species mapping from BETYdb
173+
#'
174+
#' Many-to-many relationship linking PFTs to species.
175+
#'
176+
#' @format A data frame with columns:
177+
#' \describe{
178+
#' \item{pft_id}{Foreign key to pfts}
179+
#' \item{specie_id}{Foreign key to species}
180+
#' }
181+
#' @source \url{https://betydb.org}
182+
"pfts_species"
183+
184+
#' PFT-Prior mapping from BETYdb
185+
#'
186+
#' Many-to-many relationship linking PFTs to priors.
187+
#'
188+
#' @format A data frame with columns:
189+
#' \describe{
190+
#' \item{pft_id}{Foreign key to pfts}
191+
#' \item{prior_id}{Foreign key to priors}
192+
#' }
193+
#' @source \url{https://betydb.org}
194+
"pfts_priors"
195+
196+
#' Management-Treatment mapping from BETYdb
197+
#'
198+
#' Many-to-many relationship linking managements to treatments.
199+
#'
200+
#' @format A data frame with columns:
201+
#' \describe{
202+
#' \item{management_id}{Foreign key to managements}
203+
#' \item{treatment_id}{Foreign key to treatments}
204+
#' }
205+
#' @source \url{https://betydb.org}
206+
"managements_treatments"
207+
208+
#' Cultivar-PFT mapping from BETYdb
209+
#'
210+
#' Many-to-many relationship linking cultivars to PFTs.
211+
#'
212+
#' @format A data frame with columns:
213+
#' \describe{
214+
#' \item{cultivar_id}{Foreign key to cultivars}
215+
#' \item{pft_id}{Foreign key to pfts}
216+
#' }
217+
#' @source \url{https://betydb.org}
218+
"cultivars_pfts"

0 commit comments

Comments
 (0)