knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

statcanopener

R build status

Statcanopener provides a lightweight wrapper for Statistics Canada's Web Data Service. With it, you can build Statcan's API queries into your packages, reporting workflows or Shiny apps.

(Do not use API between 12:00 midnight and 8:30AM EST lol.)

Installation

You can install the development version of statcanopener from github with:

# install.packages("remotes")
remotes::install_github("tweed1e/statcanopener")

Example

This is a basic example which shows you how to solve a common problem:

library(statcanopener)

# Get metadata for product ID 35100003
result <- getCubeMetadata(35100003) # returns httr response object
content <- httr::content(result) # extract content of response

str(content[[1]], max.level = 2)

Related packages

This package was inspired by the cansim package, which includes this functionality and much more. This is intended to be a bare bones, non-opinionated wrapper for the web data service, rather than a full-fledged end-user API access package. (E.g., this won't have a function to automatically scale from millions of $ to $.)



tweed1e/statcanopener documentation built on Jan. 19, 2021, 4:23 p.m.