{"id":16732300,"url":"https://github.com/vlucet/rgovcan","last_synced_at":"2025-03-23T15:31:01.780Z","repository":{"id":49601711,"uuid":"186158780","full_name":"VLucet/rgovcan","owner":"VLucet","description":"Easy access to the Canadian Open Government Portal","archived":false,"fork":false,"pushed_at":"2022-11-24T15:09:32.000Z","size":733,"stargazers_count":22,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T21:50:52.822Z","etag":null,"topics":["api-wrapper","canada","openscience","package","r"],"latest_commit_sha":null,"homepage":"https://vlucet.github.io/rgovcan/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VLucet.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-11T16:52:15.000Z","updated_at":"2024-08-15T20:21:48.000Z","dependencies_parsed_at":"2023-01-22T01:45:58.266Z","dependency_job_id":null,"html_url":"https://github.com/VLucet/rgovcan","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VLucet%2Frgovcan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VLucet%2Frgovcan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VLucet%2Frgovcan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VLucet%2Frgovcan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VLucet","download_url":"https://codeload.github.com/VLucet/rgovcan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245122701,"owners_count":20564358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","canada","openscience","package","r"],"created_at":"2024-10-12T23:40:43.660Z","updated_at":"2025-03-23T15:31:01.412Z","avatar_url":"https://github.com/VLucet.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(echo = TRUE)\n```\n\n# rgovcan \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=140/\u003e\n## Easy Access to the Canadian Open Government Portal\n\n[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)\n[![R-CMD-check](https://github.com/VLucet/rgovcan/workflows/R-CMD-check/badge.svg)](https://github.com/VLucet/rgovcan/actions)\n[![Codecov test coverage](https://codecov.io/gh/VLucet/rgovcan/branch/master/graph/badge.svg)](https://codecov.io/gh/VLucet/rgovcan?branch=master)\n[![CRAN Version](https://img.shields.io/cran/v/rgovcan?label=CRAN)](https://CRAN.R-project.org/package=rgovcan)\n[![Downloads](https://cranlogs.r-pkg.org/badges/rgovcan?color=blue)](https://CRAN.R-project.org/package=rgovcan/)\n\nA R package to interact with the Open Canada API (see \u003chttps://open.canada.ca/en/access-our-application-programming-interface-api\u003e), to search and download datasets (see Licence at \u003chttps://open.canada.ca/en/open-government-licence-canada\u003e). It is our hope that we will be able to bring this package up to the standard of a `ropensci` packages (see this issue on `ropensci/wishlist` https://github.com/ropensci/wishlist/issues/27).\n\nThis package makes extensive use of `ckanr` to access the Canadian government's CKAN REST API.\n\nThe code is under GPL-3 license. All the data is under Open Government License\n(http://open.canada.ca/en/open-government-licence-canada).\n\nHex Logo done with `hexSticker`: https://github.com/GuangchuangYu/hexSticker\n\n\n## Installation\n\nYou can install `rgovcan` from CRAN like so:\n```r\ninstall.packages(\"rgovcan\")\n```\n\nFor the development version, you will need to use [`remotes`](https://CRAN.R-project.org/package=remotes) to install from source:\n\n```r\ninstall.packages(\"remotes\")\nremotes::install_github(\"vlucet/rgovcan\")\n```\n\n## Usage\n\n1. First, load the package. The default [`ckanr`](https://CRAN.R-project.org/package=ckanr) url will be set to the Open Canada Portal.\n\n```{r}\nlibrary(\"rgovcan\")\n```\n\nIf you happen to change the default url, you can reset it back to the default with `govcan_setup()`.\n\n```{r}\ngovcan_setup()\n```\n\n2. A typical workflow with `rgovcan` can start with running `govcan_search()` on a given set of keywords. This yields a `stack` of `ckan_packages()` (object of class `ckan_package_stack`).\n\n```{r}\ndfo_search \u003c- govcan_search(keywords = c(\"dfo\"), records = 10)\ndfo_search # outputs a `ckan_package_stack`\n```\n\nsee `?govcan_search` for further details.\n\n3. Another possibility is to start with a package id corresponding to an actual record and retrieve a `ckan_package`.\n\n```{r}\nid \u003c- \"7ac5fe02-308d-4fff-b805-80194f8ddeb4\" # Package ID\nid_search \u003c- govcan_get_record(record_id = id)\nid_search # outputs a `ckan_package`\n```\n\n4. Once the packages have been retrieved from the portal, you can use `govcan_get_resources` on those results to display the `ckan_resource`s contained in the packages (a \"resource\" is any dataset attached to a given record). This outputs a `ckan_resource_stack` when called on a unique package.\n```{r}\nid_resources \u003c- govcan_get_resources(id_search)\nid_resources # outputs a `resource_stack`\n```\n\nOr a list of stacks if called onto a `ckan_package_stack`.\n\n```{r}\ndfo_resources \u003c- govcan_get_resources(dfo_search)\ndfo_resources # outputs a list of `resource_stack`s\n```\n\n5. Finally, you can download the resources with `govcan_dl_resources()`. These can either be stored to a certain directory or load into session (* this option might fail due to current issues with `ckanr::ckan_fetch`).\n\n```{r}\npath \u003c- \"tmp/data/\"\ndir.create(path, recursive = TRUE)\ngovcan_dl_resources(id_resources, path = path)\n```\n\nsee `?govcan_dl_resources` for further details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlucet%2Frgovcan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvlucet%2Frgovcan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlucet%2Frgovcan/lists"}