Skip to content

Commit

Permalink
Remove rgdal dependency (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy authored Jan 15, 2024
1 parent cfd96ed commit 710494f
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 253 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ vignettes/rdefra_vignette.Rmd.orig
vignettes/precompile.R
_pkgdown.yml
^\.github$
^rdefra\.Rproj$
92 changes: 19 additions & 73 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
# NOTE: This workflow is overkill for most R packages
# check-standard.yaml is likely a better choice
# usethis::use_github_action("check-standard") will install it.
#
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]

name: R-CMD-check

Expand All @@ -26,78 +18,32 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '3.6'}
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
id: install-r
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v1

- name: Install pak and query dependencies
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
pak::local_system_requirements(execute = TRUE)
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
shell: Rscript {0}

- name: Install dependencies
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("rcmdcheck")
shell: Rscript {0}

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
45 changes: 14 additions & 31 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]

name: lint

jobs:
lint:
runs-on: macOS-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
use-public-rspm: true

- name: Install dependencies
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("lintr")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
60 changes: 31 additions & 29 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: macOS-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Query dependencies
- name: Test coverage
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install dependencies
- name: Show testthat output
if: always()
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
16 changes: 7 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: rdefra
Title: Retrieve Data from the UK AIR Database
Version: 0.3.9
Title: Interact with the UK AIR Pollution Database from DEFRA
Version: 0.3.9.9000
Authors@R: c(person(given = "Cheryl",
family = "Lim",
role = c("aut", "cre"),
role = c("aut"),
email = "[email protected]"),
person(given = "Claudia",
family = "Vitolo",
role = c("aut"),
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-4252-1176", "Claudia is the original creator of the package")),
person("Andrew", "Russell", role = c("ctb"),
Expand All @@ -22,7 +22,6 @@ Authors@R: c(person(given = "Cheryl",
person("Hao", "Zhu", role = c("ctb"),
comment = "Hao Zhu reviewed the package for rOpenSci, see
https://github.com/ropensci/software-review/issues/68"))
Maintainer: Claudia Vitolo <[email protected]>
URL: https://docs.ropensci.org/rdefra/, https://github.com/ropensci/rdefra
BugReports: https://github.com/ropensci/rdefra/issues
Description: This packages allows to retrieve air pollution data from the Air
Expand All @@ -33,12 +32,11 @@ Description: This packages allows to retrieve air pollution data from the Air
The package is described in Vitolo et al. (2016) "rdefra: Interact with the
UK AIR Pollution Database from DEFRA" <doi:10.21105/joss.00051>.
Depends: R (>= 3.5.0)
Imports: lubridate, tibble, httr, xml2, dplyr, sf, rgdal, curl
Imports: lubridate, tibble, httr, xml2, dplyr, sf, curl
Suggests: testthat, rmarkdown, knitr, ggplot2, zoo
SystemRequirements: GDAL
VignetteBuilder: knitr
LazyData: true
Encoding: UTF-8
License: GPL-3
Repository: CRAN
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export(ukair_catalogue)
export(ukair_get_coordinates)
export(ukair_get_hourly_data)
export(ukair_get_site_id)
import(rgdal)
importFrom(curl,has_internet)
importFrom(dplyr,bind_rows)
importFrom(httr,GET)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
rdefra (development)
==============

Remove dependency on rgdal.

rdefra 0.3.8
==============

Expand Down
24 changes: 7 additions & 17 deletions R/rdefra-package.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
#' rdefra: Interact with the UK AIR Pollution Database from DEFRA
#'
#' The R package rdefra allows to retrieve air pollution data from the Air
#' Information Resource (UK-AIR) of the Department for Environment, Food and
#' Rural Affairs in the United Kingdom (see \url{https://uk-air.defra.gov.uk/}).
#' UK-AIR does not provide public APIs for programmatic access to data,
#' therefore this package scrapes the HTML pages to get relevant information.
#'
#' @name rdefra
#' @docType package
#'
#' @import rgdal
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
#' @importFrom curl has_internet
#' @importFrom httr GET content http_error set_config config
#' @importFrom utils read.csv
Expand All @@ -18,7 +10,7 @@
#' @importFrom tibble as_tibble
#' @importFrom dplyr bind_rows
#' @importFrom sf st_as_sf st_transform st_coordinates
#'
## usethis namespace: end
NULL

#' List of all the DEFRA air quality monitoring stations with complete
Expand All @@ -28,8 +20,6 @@ NULL
#' installed in the UK and operated by DEFRA networks (as per February 2016).
#' As the network expands, metadata for new stations will be added.
#'
#' @usage data("stations")
#'
#' @format A data frame with 6561 observations on the following 14 variables.
#' \describe{
#' \item{\code{UK.AIR.ID}}{ID reference for monitoring stations}
Expand All @@ -54,7 +44,7 @@ NULL
#' \item{\code{SiteID}}{Site ID, used to retrieve time series data.}
#' }
#'
#' @keywords datasets
#'
#' @source \url{https://uk-air.defra.gov.uk/}
#' @examples
#' stations
"stations"
2 changes: 1 addition & 1 deletion R/ukair_get_site_id.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Get site identification numbers for DEFRA stations
#'
#' @description Given the UK AIR ID (from the \code{ukair_catalogue()}), this
#' @description Given the UK AIR ID (from [ukair_catalogue()]), this
#' function fetches the catalogue of monitoring stations from DEFRA's website.
#'
#' @param id_s An alphanumeric string (or vector of strings) containing the UK
Expand Down
Loading

0 comments on commit 710494f

Please sign in to comment.