From 7b45b4a747add0e668d0cbafa2dc3cd4d095ec54 Mon Sep 17 00:00:00 2001 From: runner Date: Thu, 23 Mar 2023 13:19:04 +0000 Subject: [PATCH 1/3] Re-build README.Rmd --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d2d8623..4f4a166 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,8 @@ so the dataset name will be gp-practice-populations. Contributing to phsopendata --------------------------- -At present, this package is maintained by the [PHS Open Data -team](phs.opendata@phs.scot). +At present, this package is maintained by [David +Aikman](https://github.com/daikman). If you have requests or suggestions for additional functionality, please contact the package maintainer and/or the [PHS Open Data From 992901a438e4f3a4793ecdda88ab13a44c028ea3 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Wed, 10 Jan 2024 10:16:23 +0000 Subject: [PATCH 2/3] Add a release badge to the README --- README.Rmd | 1 + README.md | 80 ++++++++++++++++++++++++++++++------------------------ 2 files changed, 45 insertions(+), 36 deletions(-) diff --git a/README.Rmd b/README.Rmd index a5083a8..9b81809 100644 --- a/README.Rmd +++ b/README.Rmd @@ -16,6 +16,7 @@ knitr::opts_chunk$set( # phsopendata +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/Public-Health-Scotland/phsopendata)](https://github.com/Public-Health-Scotland/phsopendata/releases/latest) [![R build status](https://github.com/Public-Health-Scotland/phsopendata/workflows/R-CMD-check/badge.svg)](https://github.com/Public-Health-Scotland/phsopendata/actions) diff --git a/README.md b/README.md index 4f4a166..56b1f90 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ + -phsopendata -=========== +# phsopendata +[![GitHub release (latest by +date)](https://img.shields.io/github/v/release/Public-Health-Scotland/phsopendata)](https://github.com/Public-Health-Scotland/phsopendata/releases/latest) [![R build status](https://github.com/Public-Health-Scotland/phsopendata/workflows/R-CMD-check/badge.svg)](https://github.com/Public-Health-Scotland/phsopendata/actions) @@ -26,60 +28,65 @@ For extracting metadata and search functionality, we recommend using the RStudio. However, depending on firewall settings, proxy use may need to be configured with `use_proxy()`. -Installation ------------- +## Installation You need to install `phsopendata` from GitHub, which requires a package like `remotes` or `devtools`. Using `remotes` you run this to install the package: - remotes::install_github("Public-Health-Scotland/phsopendata", - upgrade = "never" - ) +``` r +remotes::install_github("Public-Health-Scotland/phsopendata", + upgrade = "never" +) +``` -Examples --------- +## Examples ### Downloading a data table with `get_resource()` To extract a specific resource, you will need it’s unique identifier - resource id. This can be found in the dataset metadata, the URL of a -resource’s page on -https://www.opendata.nhs.scot/, -or extracted using `ckanr::package_show`. +resource’s page on , or extracted using +`ckanr::package_show`. - library(phsopendata) +``` r +library(phsopendata) - # define a resource ID - res_id <- "a794d603-95ab-4309-8c92-b48970478c14" +# define a resource ID +res_id <- "a794d603-95ab-4309-8c92-b48970478c14" - # download the data from the CKAN database - data <- get_resource(res_id = "a794d603-95ab-4309-8c92-b48970478c14") +# download the data from the CKAN database +data <- get_resource(res_id = "a794d603-95ab-4309-8c92-b48970478c14") +``` ### Querying/filtering data with `get_resource()` You can define a row limit with the `rows` argument to get the first *N* rows of a table. - # get first 100 rows - get_resource( - res_id = "a794d603-95ab-4309-8c92-b48970478c14", - rows = 100 - ) +``` r +# get first 100 rows +get_resource( + res_id = "a794d603-95ab-4309-8c92-b48970478c14", + rows = 100 +) +``` You can use `col_select` and `row_filters` to query the data server-side (i.e., the data is filtered before it is downloaded to your machine). - # get first 100 rows - get_resource( - res_id = "a794d603-95ab-4309-8c92-b48970478c14", - col_select = c("GPPracticeName", "TelephoneNumber"), - row_filters = list( - HB = "S08000017", - Dispensing = "Y" - ) - ) +``` r +# get first 100 rows +get_resource( + res_id = "a794d603-95ab-4309-8c92-b48970478c14", + col_select = c("GPPracticeName", "TelephoneNumber"), + row_filters = list( + HB = "S08000017", + Dispensing = "Y" + ) +) +``` ### Downloading multiple tables with `get_dataset()` @@ -93,12 +100,13 @@ from: [opendata.nhs.scot/dataset/*gp-practice-populations*](https://www.opendata.nhs.scot/dataset/gp-practice-populations), so the dataset name will be gp-practice-populations. - # if max_resources is not set, all resources will be returned by default. - # Here we pull 10 rows from the first 2 resources only - get_dataset("gp-practice-populations", max_resources = 2, rows = 10) +``` r +# if max_resources is not set, all resources will be returned by default. +# Here we pull 10 rows from the first 2 resources only +get_dataset("gp-practice-populations", max_resources = 2, rows = 10) +``` -Contributing to phsopendata ---------------------------- +## Contributing to phsopendata At present, this package is maintained by [David Aikman](https://github.com/daikman). From 634cb279b627ee8c211a7c87eb7649a9e2d56630 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Wed, 10 Jan 2024 10:31:51 +0000 Subject: [PATCH 3/3] Fix maintainer I think README.md had been edited, so when I edited README.Rmd and it was re-knitted it overwrote the changes. --- README.Rmd | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.Rmd b/README.Rmd index 9b81809..c057b95 100644 --- a/README.Rmd +++ b/README.Rmd @@ -95,7 +95,7 @@ get_dataset("gp-practice-populations", max_resources = 2, rows = 10) ## Contributing to phsopendata -At present, this package is maintained by [David Aikman](https://github.com/daikman). +At present, this package is maintained by [Csilla Scharle](https://github.com/csillasch). If you have requests or suggestions for additional functionality, please contact the package maintainer and/or the [PHS Open Data team](phs.opendata@phs.scot). diff --git a/README.md b/README.md index 56b1f90..70cbf1e 100644 --- a/README.md +++ b/README.md @@ -108,8 +108,8 @@ get_dataset("gp-practice-populations", max_resources = 2, rows = 10) ## Contributing to phsopendata -At present, this package is maintained by [David -Aikman](https://github.com/daikman). +At present, this package is maintained by [Csilla +Scharle](https://github.com/csillasch). If you have requests or suggestions for additional functionality, please contact the package maintainer and/or the [PHS Open Data