get_bivariate: Find simaltaneous measurements of two parameters

Description Usage Arguments Value Examples

View source: R/database.R

Description

Find sampling activities that have associated measurements of two parameters of interest - helpful for bivariate plotting/ investigating the relationship between two parameters.

Usage

1
2
3
4
get_bivariate(cyan_connection, parameter_1, parameter_2,
  north_latitude = NULL, south_latitude = NULL,
  west_longitude = NULL, east_longitude = NULL, years = NULL,
  states = NULL)

Arguments

cyan_connection

a CyAN database connection from connect_cyan

parameter_1, parameter_2

CyAN parameter codes for the two parameters of interest

north_latitude, south_latitude

numbers 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

nunbers 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

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.

Value

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. Returns a wide data frame, with a shared columns related to the activity, and columns related to the analytical result suffixed with a ".1" for parameter 1 and ".2" for parameter 2.

Examples

1
2
3
4
5
6
7
8
9
#Connect to the example database bundled with CyAN
path <- system.file("extdata", "example.db", package = "CyAN")
db_connection <- connect_cyan(path)

#Get simaltaneous observations of secchi depth (P0002) and chlorophyll-a (P0051)
biv_secchi_chla <- get_bivariate(db_connection,
                                 parameter_1 = "P0002", parameter_2 = "P0051",
                                 north_latitude = 37.818, south_latitude = 37.714,
                                 west_longitude = -98.028, east_longitude = -97.735)

PatrickEslick/CyAN documentation built on Oct. 2, 2019, 5:50 p.m.