Skip to content

Commit

Permalink
Merge pull request #104 from inbo/dev_nextrelease
Browse files Browse the repository at this point in the history
Release version 0.4.2
  • Loading branch information
florisvdh authored Sep 15, 2023
2 parents 5da5ed8 + 5daa3aa commit d35e7b4
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 173 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/R-CMD-check-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ jobs:
fail-fast: false
matrix:
config:
- {os: ubuntu-20.04, r: 'release'}
- {os: ubuntu-20.04, r: 'devel'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-18.04, r: 'devel'}
# - {os: ubuntu-22.04, r: 'release'}
# - {os: ubuntu-22.04, r: 'devel'}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}

Expand All @@ -35,13 +33,15 @@ jobs:
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-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: false

- name: Query dependencies
run: |
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
path: check
71 changes: 16 additions & 55 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- '*'

name: R-CMD-check

Expand All @@ -15,71 +17,30 @@ jobs:
fail-fast: false
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-22.04, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
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
- 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: 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: Restore (or define new) R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ matrix.config.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'release <- system("lsb_release -rs", intern = TRUE); writeLines(remotes::system_requirements("ubuntu", release))')
cache-version: ${{ secrets.CACHE_VERSION }}
extra-packages: any::rcmdcheck
needs: check

- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install udunits
brew install gdal
brew install proj
- name: Install package dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(rmarkdown.html_vignette.check_title = FALSE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
path: check
- uses: r-lib/actions/check-r-package@v2
50 changes: 10 additions & 40 deletions .github/workflows/site-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,23 @@ name: site-deploy

jobs:
site-deploy:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
runs-on: ubuntu-22.04
env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}

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

- 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: Restore (or define new) R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
use-public-rspm: true

- name: Install system dependencies (Linux)
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'release <- system("lsb_release -rs", intern = TRUE); writeLines(remotes::system_requirements("ubuntu", release))')
sudo apt-get install -y libfribidi-dev libharfbuzz-dev
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: ${{ secrets.CACHE_VERSION }}
extra-packages: local::., [email protected]
needs: website

- name: Deploy package
run: |
Expand Down
52 changes: 11 additions & 41 deletions .github/workflows/site-devel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,30 @@ name: site-devel

jobs:
site-devel:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
runs-on: ubuntu-22.04
env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}

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

- 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: Restore (or define new) R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
use-public-rspm: true

- name: Install system dependencies (Linux)
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'release <- system("lsb_release -rs", intern = TRUE); writeLines(remotes::system_requirements("ubuntu", release))')
sudo apt-get install -y libfribidi-dev libharfbuzz-dev
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: ${{ secrets.CACHE_VERSION }}
extra-packages: local::., [email protected]
needs: website

- name: Build site
run: |
Rscript -e 'options(rmarkdown.html_vignette.check_title = FALSE); pkgdown::build_site()'
- name: Upload pkgdown-site as artifact
uses: actions/upload-artifact@main
uses: actions/upload-artifact@v3
with:
name: pkgdown-site
path: docs
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "GPL-3.0",
"upload_type": "software",
"access_right": "open",
"version": "0.4.1",
"version": "0.4.2",
"creators": [
{
"name": "Vanderhaeghe, Floris",
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: watina
Title: Querying and Processing Data from the INBO Watina Database
Version: 0.4.1
Version: 0.4.2
Description: The R-package watina contains functions to query
and process data from the Watina database at the Research Institute for
Nature and Forest (INBO). This database primarily provides
Expand All @@ -23,7 +23,6 @@ Imports:
assertthat,
dplyr,
inbodb,
KSgeneral,
lubridate,
rlang,
stringr,
Expand All @@ -32,6 +31,7 @@ Imports:
Suggests:
DBI,
knitr,
KSgeneral,
purrr,
rmarkdown,
sf,
Expand All @@ -41,5 +41,5 @@ Remotes:
inbo/inbodb
LazyData: true
Encoding: UTF-8
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
VignetteBuilder: knitr
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export(get_locs)
export(get_xg3)
export(selectlocs_chem)
export(selectlocs_xg3)
importFrom(KSgeneral,disc_ks_test)
importFrom(assertthat,assert_that)
importFrom(assertthat,has_args)
importFrom(assertthat,has_name)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# watina 0.4.2 (2023-09-15)

- Move package {KSgeneral} to `Suggests` (#103).
This avoids package breaking when {KSgeneral} is not available on CRAN.
For the moment not taking further measures to protect against it, as the package is currently back on CRAN.

# watina 0.4.1 (2021-06-11)

- Fixed non-working `get_xg3()` and `get_chem()` for dataframe input, by avoiding the currently defunct `dbplyr::db_drop_table()` (#89, [08bc66d](https:/inbo/watina/commit/08bc66d)).
Expand Down
34 changes: 20 additions & 14 deletions R/eval.R
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ qualify_xg3 <- function(data,
#' @importFrom rlang .data
#' @importFrom assertthat
#' assert_that
#' @importFrom KSgeneral
#' disc_ks_test
#' @importFrom stringr
#' str_detect
#' @importFrom stats
Expand All @@ -382,6 +380,8 @@ eval_xg3_series <- function(data,
max_gap,
min_dur) {

require_pkgs("KSgeneral")

if (missing(xg3_type)) {
xg3_type <- match.arg(xg3_type)} else {
assert_that(all(xg3_type %in%
Expand Down Expand Up @@ -410,11 +410,13 @@ eval_xg3_series <- function(data,
ser_rel_nryears = .data$ser_nryears / .data$ser_length,
ser_firstyear = min(.data$hydroyear),
ser_lastyear = max(.data$hydroyear),
ser_pval_uniform = disc_ks_test(.data$hydroyear,
ecdf(seq(.data$ser_firstyear,
.data$ser_lastyear)),
exact = TRUE) %>%
.$p.value
ser_pval_uniform = KSgeneral::disc_ks_test(
.data$hydroyear,
ecdf(seq(.data$ser_firstyear,
.data$ser_lastyear)),
exact = TRUE
) %>%
.$p.value
) %>%
ungroup
},
Expand Down Expand Up @@ -650,6 +652,8 @@ eval_chem <- function(data,
type = c("avail", "num", "both"),
uniformity_test = FALSE) {

require_pkgs("KSgeneral")

type <- match.arg(type)

assert_that(inherits(data, what = c("tbl_lazy", "data.frame")),
Expand Down Expand Up @@ -774,13 +778,15 @@ date, lab_sample_id, chem_variable, value, unit, below_loq."
df %>%
summarise(
nryears = sum(.data$available),
pval_uniform_totalspan = ifelse(.data$nryears > 0,
disc_ks_test(.data$year[.data$available],
ecdf(seq(firstyear,
lastyear)),
exact = TRUE) %>%
.$p.value,
NA)
pval_uniform_totalspan = ifelse(
.data$nryears > 0,
KSgeneral::disc_ks_test(.data$year[.data$available],
ecdf(seq(firstyear,
lastyear)),
exact = TRUE) %>%
.$p.value,
NA
)
) %>%
select(-.data$nryears) %>%
ungroup
Expand Down
Loading

0 comments on commit d35e7b4

Please sign in to comment.