knitr::opts_chunk$set( collapse = TRUE, comment = "#>", warning = FALSE, message = FALSE )
Some resources from the City of Toronto Open Data Portal are ZIP files containing multiple files. When a resource like this is retrieved using get_resource()
, the result is a list with elements named after each file.
For example, the dataset on the Annual Summary of Reportable Communicable Diseases:
library(opendatatoronto) library(dplyr) summary_diseases <- search_packages("Annual Summary of Reportable Communicable Diseases") %>% list_package_resources() %>% filter(name == "summary-of-reportable-communicable-diseases-in-toronto-2007-2017") %>% get_resource() str(summary_diseases, max.level = 1)
To access a single file, you can pull out the element by name:
summary_diseases[["RatesbyDisease2007_2017.csv"]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.