R/rcax_table_query.R
rcax_table_query.Rd
This is the base function for queries for most of the CAX tables.
Default queries will download 1000 records. You will
want to make a filtered query by passing in flist
as a list with the column name values to filter on.
The name of the table in the CAX API. See rcax_datasets()
for the names.
A filter for the query. See details and rcax_filter()
Additional query parameters. See rcax_table_query()
for details.
column names to return. Use cols=NULL if you want all columns. Names are case insensitive.
The columns to sort on for the returned table. The order of sortcols indicates the order of sorting. Start with the smallest group and work outwards, e.g. c("spawningyear", "popid", "MPG")
. Names are case insensitive.
whether to return the table ("data.frame") or colnames with definitions ("colnames"). Default is to return the table as a data frame.
A list of arguments for the rcax_GET()
call. These do not need to be specified by the user unless the user wants to change the default values. table_id
This is the CAX table id. It is looked up using tablename
and rCAX:::caxpops
(an internal dataset). If table_id
is passed in via GETargs
, it will override the default table id lookup. recordloc
This is the name of the record we want in the list returned from the GET call. key
is the API key.
Curl options passed to HttpClient
data frame if type="data.frame"
(default) and the colnames if type="colnames"
The required query parameters are table_id and XAPIKEY. These are set from the information in GETargs
. table_id is normally looked up from rcax_datasets()
using the tablename
. The qlist
argument is any additional query parameters. The following are some of the available extra (meaning not required) query parameters.
page=num Integer of the page selected.
per_page=num Integer for the number of records per page.
limit=num Maximum number of records to return. Default is 1000.
agency=character Agency that submitted the record. You can designate one or more (comma-separated) agency acronyms: IDFG, WDFW, ODFW, CRITFC, CCT, NOAA.
updated_since Date since epoch in seconds: 2012-04-24 15:05:22 -0400 = 1335294322.
popid Population id in NOSA tables.
Filtering, i.e. subsetting, the query is specified using the flist
argument.
This is a list with the column name and value. See rcax_filter()
for the filtering code which writes the filter query parameter that is added to the GET query. See rcax_filter()
for examples of how one passes in flist
.
API docs at https://www.streamnet.org/resources/exchange-tools/rest-api-documentation/