Description Usage Arguments Value Examples
Basic data query from the CyAN database based on a number of parameters, used to drive the data download from the map screen of the shiny app. Can also be used with the plotting functions
1 2 3 4 |
cyan_connection |
a CyAN database connection from |
collect |
a logical indicating whether the query will be pulled into a local tibble using dbplyr::collect. If you are planning on doing further selection or filtering using dplyr, you may want not want to collect until you're ready |
north_latitude, south_latitude |
numerics indicating the northern most and sothern most latitude that will be included in the query. Latitude should be given as a positive number of degrees north of the equator. |
west_longitude, east_longitude |
numerics indicating the western most and eastern most latitude that will be included in the query. Longitude should be given as a negative number of decimal degrees west of the prime meridian. |
years |
numeric vector of years that will be included in the query |
parameters |
a character vector of parameter names that will be returned in the query |
minimum_tier |
a number between 1.0 and 4.0 indicating the minimum data tier that will be returned in the query |
states |
a character vector of the postal codes for the states to be included in the query. Usually, this would not be used if querying by latitude and longitude. |
if collect is FALSE, the query will be generated, but not collected.
See the documentation on collect()
for details. Otherwise, if collect
is TRUE, the query will be pulled into memory and returned as a tibble.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #Connect to the example database bundled with CyAN
path <- system.file("extdata", "example.db", package = "CyAN")
db_connection <- connect_cyan(path)
#Get all of the chlorophyll and chlorophyll-a data (parameter id P0051 & P0054)
#or the state of Kansas in the year 2016
ks_chl_2016 <- get_cyan_data(db_connection,
years = 2016,
parameters = c("P0051", "P0054"),
states = "KS")
#Get chlorophyll-a data within a latitude longitude bounding box. If you
#need to reference the parameter table to find parameter codes, you can use
#generate_parameter_index()
chla_2017 <- get_cyan_data(db_connection,
north_latitude = 37.818, south_latitude = 37.714,
west_longitude = -98.028, east_longitude = -97.735,
years = 2017:2018,
parameters = "P0051")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.