Returns EscData table sorted by refid and countdate.

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

rcax_escdata() will download 1000 records.

rcax_escdata(
  tablename = "EscData",
  flist = NULL,
  qlist = NULL,
  cols = NULL,
  sortcols = c("countdate", "refid"),
  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

# First 5 columns of first 5 results
rcax_escdata(cols = NULL, qlist=list(limit=5))[,1:5]
#>   ascode countpermile repeatspawners asnid agencyid
#> 1     98            0                   98       10
#> 2     98                                98       15
#> 3     98                                98       15
#> 4     98                                98       15
#> 5     98                                98       36

# to print the first column names and definitions
head(rcax_escdata(type="colnames"))
#>         name definition
#> 5   agencyid       <NA>
#> 1     ascode       <NA>
#> 24  asmethod       <NA>
#> 4      asnid       <NA>
#> 25  assource       <NA>
#> 9  begindate       <NA>