/rppo

R package for accessing PPO data store

Primary LanguageR

rppo

Build Status codecov.io R-CMD-check

The global plant phenology data portal, is an aggregation of plant phenological observations from USA-NPN, NEON, and PEP725 representing 20 million phenological observations from across North America and Europe. The PPO data portal utilizes the Plant Phenology Ontology (PPO) to align phenological terms and measurements from the various databases. The rppo R package enables programmatic access to all data contained in the PPO data portal incuding selected classes contained in the PPO itself.

For information on how data is assembled for the PPO data portal, visit the ppo-data-pipeline git repository.

Installation

You can install rppo from github with:

install.packages("devtools")
devtools::install_github("ropensci/rppo")
library(rppo)

Examples

Following are a couple of brief examples to illustrate how to get started with rppo. We recommend visiting the rppo vignette for a more complete set of examples on using the rppo package, as well as viewing man pages for rppo functions in the R environment, using ?ppo_data and ?ppo_terms.

# query all results from day 1 through 100 in a particular bounding box, 
# limited to 2 records
r <- ppo_data(fromDay = 1, toDay = 100, bbox="37,-120,38,-119", limit=2, timeLimit=10)
#> sending request for data ...
#> https://www.plantphenology.org/api/v2/download/?q=%2Blatitude:>=37+AND+%2Blatitude:<=38+AND+%2Blongitude:>=-120+AND+%2Blongitude:<=-119+AND+%2BdayOfYear:>=1+AND+%2BdayOfYear:<=100+AND+source:USA-NPN,NEON&source=latitude,longitude,year,dayOfYear,termID&limit=2

# view the data returned
print(r$data)
#>   dayOfYear year   genus specificEpithet latitude longitude
#> 1        33 2017 Quercus       douglasii 37.11144 -119.7315
#> 2        96 2017  Bromus        diandrus 37.11144 -119.7315
#>                                                                                                                                                                                                                                            termID
#> 1                                                                                                                                                                                                 obo:PPO_0002610,obo:PPO_0002013,obo:PPO_0002000
#> 2 obo:PPO_0002601,obo:PPO_0002610,obo:PPO_0002005,obo:PPO_0002604,obo:PPO_0002605,obo:PPO_0002013,obo:PPO_0002003,obo:PPO_0002000,obo:PPO_0002602,obo:PPO_0002006,obo:PPO_0002007,obo:PPO_0002004,obo:PPO_0002008,obo:PPO_0002603,obo:PPO_0002600
#>   source
#> 1   NEON
#> 2   NEON
#>                                                              eventId
#> 1 https://n2t.net/ark:/21547/Amn2cd982ca2-6147-4a63-a864-f4e556420562
#> 2 https://n2t.net/ark:/21547/Amn2d1a3e6de-7885-404f-828f-9ebf63248d68

# view the number of possible records returned
print(r$number_possible)
#> [1] 7251

# return a data frame of present
presentTerms <- ppo_terms(present = TRUE, timeLimit=10)
#> sending request for terms ...

# print the 2nd present term returned
print(presentTerms[2,])
#>            termID                            label
#> 2 obo:PPO_0002358 abscised fruits or seeds present
#>                                                                                                                                                                                                                                                                                                                                  definition
#> 2 An 'abscised fruit or seed presence' (PPO:0002059) trait that is a 'quality of' (RO:0000080) a 'whole plant' (PO:0000003) from which at least one 'ripe fruit' (PPO:0001045) has been abscised or removed by an herbivore or that has at least one 'ripe fruit' (PPO:0001045) that has abscised at least one 'mature seed' (PPO:0001024).
#>                                          uri
#> 2 https://purl.obolibrary.org/obo/PPO_0002358

Citation

To cite the ‘rppo’ R package in publications use:

   'John Deck, Brian Stucky, Ramona Walls, Kjell Bolmgren, Ellen Denny, Salix Dubois, Robert Guralnick' (2022). rppo: An interface to the Plant Phenology Ontology and associated data store.  R package version 2.0
   https://github.com/ropensci/rppo

Code of Conduct

View our code of conduct

ropensci_footer