opendatatoronto is an R interface to the City of Toronto Open Data Portal. The goal of the package is to help read data directly into R without needing to manually download it via the portal.

For more information, please visit the package website and vignettes:

Installation

You can intall the released version of opendatatoronto from CRAN:

install.packages("opendatatoronto")

or the development version from GitHub with:

Usage

In the Portal, datasets are called packages. You can see a list of available packages by using list_packages(). This will show metadata about the package, including what topics (i.e. tags) the package covers, any civic issues it addresses, a description of it, how many resources there are (and their formats), how often it is is refreshed and when it was last refreshed.

You can also search packages by title:

Or see metadata for a specific package:

Within a package, there are a number of resources - e.g. CSV, XSLX, JSON, SHP files, and more. Resources are the actual “data”.

For a given package, you can get a list of resources using list_package_resources(). You can pass it the package id (which is contained in marriage_license_packages below):

But you can also get a list of resources by using the package’s URL from the Portal:

Finally (and most usefully!), you can download the resource (i.e., the actual data) directly into R using get_resource():