Title: | Access the City of Toronto Open Data Portal |
---|---|
Description: | Access data from the "City of Toronto Open Data Portal" (<https://open.toronto.ca>) directly from R. |
Authors: | Sharla Gelfand [aut, cre], City of Toronto [cph, fnd] |
Maintainer: | Sharla Gelfand <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.5 |
Built: | 2024-10-29 03:01:14 UTC |
Source: | https://github.com/sharlagelfand/opendatatoronto |
Opens a browser to the package's page on the City of Toronto Open Data Portal.
browse_package(package)
browse_package(package)
package |
A way to identify the package. Either a package ID (passed as a character vector directly), a single package resulting from |
A browser is opened to the package's page on the City of Toronto Open Data Portal website if the session is interactive. The URL is returned as a character string.
ttc_subway_delays <- search_packages("ttc subway delay") browse_package(ttc_subway_delays) browse_package("https://open.toronto.ca/dataset/business-improvement-areas/")
ttc_subway_delays <- search_packages("ttc subway delay") browse_package(ttc_subway_delays) browse_package("https://open.toronto.ca/dataset/business-improvement-areas/")
Opens a browser to https://open.toronto.ca
.
browse_portal()
browse_portal()
A browser is opened to the City of Toronto Open Data Portal website if the session is interactive. The URL is returned as a character string.
browse_portal()
browse_portal()
Opens a browser to the resource's package page on the City of Toronto Open Data Portal.
browse_resource(resource)
browse_resource(resource)
resource |
A way to identify the resource. Either a resource ID (passed as a character vector directly) or a single resource resulting from |
A browser is opened to the resource's package page on the City of Toronto Open Data Portal website if the session is interactive. The URL is returned as a character string.
ttc_subway_delays <- search_packages("ttc subway delay") res <- list_package_resources(ttc_subway_delays) browse_resource(res[1, ])
ttc_subway_delays <- search_packages("ttc subway delay") res <- list_package_resources(ttc_subway_delays) browse_resource(res[1, ])
Download a resource from the portal directly into your R session. CSV, XLS, XLSX, XML, JSON, SHP, ZIP, and GeoJSON resources are supported.
get_resource(resource)
get_resource(resource)
resource |
A way to identify the resource. Either a resource ID (passed as a character vector directly) or a single resource resulting from |
In most cases, the resource is returned as a tibble or list of tibbles. If it is a spatial resource (i.e. SHP or GeoJSON), it is returned as an sf object.
list_package_resources("https://open.toronto.ca/dataset/neighbourhoods/") %>% head(1) %>% get_resource()
list_package_resources("https://open.toronto.ca/dataset/neighbourhoods/") %>% head(1) %>% get_resource()
List resources for a package on the portal.
list_package_resources(package)
list_package_resources(package)
package |
A way to identify the package. Either a package ID (passed as a character vector directly), a single package resulting from |
A tibble of resources along with metadata, including name
,
id
, format
(the format of the resource file), and
last_modified
(the date the resource was last modified).
list_package_resources("1db34737-ffad-489d-a590-9171d500d453") list_package_resources("https://open.toronto.ca/dataset/ttc-subway-delay-data")
list_package_resources("1db34737-ffad-489d-a590-9171d500d453") list_package_resources("https://open.toronto.ca/dataset/ttc-subway-delay-data")
List packages available on the portal.
list_packages(limit = 50)
list_packages(limit = 50)
limit |
The maximum number of packages to return. The default is 50. |
A tibble of available packages and metadata, including title
, id
, topics
, civic_issues
, excerpt
, publisher
, dataset_category
, num_resources
(the number of resources in the package), formats
(the different formats of the resources), refresh_rate
(how often the package is refreshed), and last_refreshed
(the date it was last refreshed).
list_packages(5)
list_packages(5)
Search portal packages by title.
search_packages(title, limit = 50)
search_packages(title, limit = 50)
title |
Title to search (case-insensitive). |
limit |
Maximum number of packages to return. The default is 50. The maximum limit is 1000. |
A tibble of matching packages along with package metadata, including title
, id
, topics
, civic_issues
, excerpt
, publisher
, dataset_category
, num_resources
(the number of resources in the package), formats
(the different formats of the resources), refresh_rate
(how often the package is refreshed), and last_refreshed
(the date it was last refreshed).
search_packages("ttc")
search_packages("ttc")
Show a portal package's metadata.
show_package(package)
show_package(package)
package |
A way to identify the package. Either a package ID (passed as a character vector directly) or the package's URL from the portal. |
A tibble including title
, id
, topics
, civic_issues
, excerpt
, publisher
, dataset_category
, num_resources
(the number of resources in the package), formats
(the different formats of the resources), refresh_rate
(how often the package is refreshed), and last_refreshed
(the date it was last refreshed).
show_package("c01c6d71-de1f-493d-91ba-364ce64884ac")
show_package("c01c6d71-de1f-493d-91ba-364ce64884ac")