Skip to contents

Objects containing the functions associated with API functions documented here. These objects are for advanced usage, providing more functionality than the simpler tools for accessing featured_data.

Usage

ops

ops_local

ops_staging

Format

An object of class try-error of length 1.

An object of class try-error of length 1.

An object of class list of length 6.

Functions

  • ops: List containing available operations from the IIDDA API as R functions

  • ops_local: Operations list for a local development environment, if it exists

  • ops_staging: Operations list for a staging environment, if it exists

Examples

## Print out the available functions.
names(ops_staging)
#> [1] "metadata"        "data_dictionary" "lookup_tables"   "raw_csv"        
#> [5] "download"        "filter"         

## Access functions with a dollar sign. For example, this command
## will give weekly incidence data in January of 1956.
options(iidda_api_msgs = FALSE, iidda_api_all_char = TRUE)
jan_56 = ops_staging$filter(
     resource_type = "Communicable Disease Incidence"
   , dataset_id = "cdi_ca_1956_wk_prov_dbs"
   , period_end_date = "1956-01-01..1956-02-01"
   , time_scale = "wk"
)
cols = c(
    "period_end_date"
  , "location"
  , "historical_disease"
  , "cases_this_period"
)
print(jan_56[, cols])
#> # A tibble: 1,232 × 4
#>    period_end_date location historical_disease cases_this_period
#>    <chr>           <chr>    <chr>              <chr>            
#>  1 1956-01-07      CANADA   Chickenpox         927              
#>  2 1956-01-07      NFLD.    Chickenpox         9                
#>  3 1956-01-07      P.E.I.   Chickenpox         4                
#>  4 1956-01-07      N.S      Chickenpox         25               
#>  5 1956-01-07      N.B.     Chickenpox         0                
#>  6 1956-01-07      QUE.     Chickenpox         182              
#>  7 1956-01-07      ONT.     Chickenpox         511              
#>  8 1956-01-07      MAN.     Chickenpox         3                
#>  9 1956-01-07      SASK.    Chickenpox         Not reportable   
#> 10 1956-01-07      ALTA.    Chickenpox         Not reportable   
#> # ℹ 1,222 more rows

## Operations objects that are not available are error objects. As of the
## time of writing `ops` is not live, but will be.
print(class(ops))
#> [1] "try-error"

## The `ops_local` is only live for developers who have deployed a
## local version of the API.
print(class(ops_local))
#> [1] "try-error"