Returns SuperPopulations table

The SuperPopulations table_id is set automatically using a saved data frame from a rcax_datasets() call. The table is saved in R/sysdata.rda.

rcax_superpops() will download 1000 records. Pass in flist to filter.

rcax_superpops(
  tablename = "SuperPopulations",
  flist = NULL,
  qlist = NULL,
  cols = NULL,
  sortcols = c("popid"),
  type = c("data.frame", "colnames"),
  GETargs = list(table_id = NULL, recordloc = "records", key = NULL, parse = TRUE),
  ...
)

Arguments

tablename

The name of the table in the CAX API. See vignette("CAX_Tables", package = "rCAX")

flist

A filter for the query. See details and rcax_filter()

qlist

Additional query parameters. See rcax_table_query() for details.

cols

column names to return. Use cols=NULL if you want all columns. Names are case insensitive.

sortcols

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.

type

whether to return the table ("data.frame") or colnames with definitions ("colnames"). Default is to return the table as a data frame.

GETargs

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

Value

data frame if type="data.frame" (default) and the colnames if type="colnames"

Examples

# print the first columns and definitions
a <- rcax_superpops(type="colnames")
paste(a$name, a$definition, sep=": ")[1:5]
#> [1] "contactagency: Organization or person that is the best contact for questions about a specific record."                               
#> [2] "id: Value used by computer to identify a record."                                                                                    
#> [3] "num: An internal sorting id"                                                                                                         
#> [4] "popfit: Categorization of how the geographic extent of the NOSA/escapement estimate corresponds to the definition of the population."
#> [5] "popfitnotes: Text description of why the data are not at the scale of a single population."                                          

# get one record
rcax_superpops(qlist=list(limit=1))
#>   popid   popfit popfitnotes                   upddate
#> 1   302 Same                 January, 13 2020 13:59:54
#>                                contactagency num
#> 1 Pacific States Marine Fisheries Commission   1
#>                                     id publish superpopid
#> 1 0007CC8D-3ADF-4052-A178-26E29C126214     Yes       1056