-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small updates and convenience stuff (#8)
* Documentation and pkgdown addition * Adding datapaths as entry * 🚀 negated in function
- Loading branch information
1 parent
50672cc
commit dd42558
Showing
13 changed files
with
210 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# 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] | ||
pull_request: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
name: pkgdown.yaml | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: Build site | ||
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | ||
shell: Rscript {0} | ||
|
||
- name: Deploy to GitHub pages 🚀 | ||
if: github.event_name != 'pull_request' | ||
uses: JamesIves/[email protected] | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export("%notin%") | ||
export(misc_sanitizeNames) | ||
export(sp_replaceGriddedNA) | ||
export(sp_resampleRas) | ||
export(sp_replaceGriddedNA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#' Table with default paths to commonly used spatial input files | ||
#' | ||
#' @description | ||
#' This dataset contains path names to commonly-used spatial data files. Given that | ||
#' those files are usually quite large, we here only describe where to find them internally | ||
#' and not upload the data itself. | ||
#' Medium-long-term this could be improved by relying on github LFS systems or our own gitlab | ||
#' instance. | ||
#' | ||
#' @details | ||
#' The file has the following columns: | ||
#' | ||
#' [*] 'drive': The path to drive where the data is stored (Default: \code{'P:/bnr/'}). Can be system dependent (Windows/Linux). | ||
#' [*] 'access': A non-structured field containing the list of people that have access (for example \code{'IBF'} or \code{'bnr'}). | ||
#' [*] 'group': A field entry describing to what this file belongs to (i.e. \code{"EPIC"}). | ||
#' [*] 'filename': The actual filename | ||
#' | ||
#' @note | ||
#' To update or overwrite, load the file and update, then apply | ||
#' \code{usethis::use_data(bnr_datapaths, overwrite = TRUE) }. | ||
#' | ||
#' @format A [data.frame] containing paths to key spatial data sources. | ||
#' @source Manually updated and curated by BNR researchers | ||
"bnr_datapaths" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#' Inverse of 'in' call | ||
#' | ||
#' @description | ||
#' Calculates the set of entries not present in the second vector. | ||
#' Added for convenience since this is not supported by default in R. | ||
#' | ||
#' @param a First [`vector`] object. | ||
#' @param b Second [`vector`] object. | ||
#' | ||
#' @returns A [`vector`] of [`logical`] entries of \code{'a'} not present in \code{'b'}. | ||
#' @examples | ||
#' # example code | ||
# lu <- c("Forest", "Cropland", "Wetland", "OtherLand") | ||
# lu2 <- c("Forest", "Wetland", "otherland") | ||
# which(lu %notin% lu2) | ||
#' @keywords utils | ||
#' @author Martin Jung | ||
#' @export | ||
`%notin%` = function(a, b){!(a %in% b)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
url: https://iiasa.github.io/BNRTools/ | ||
template: | ||
bootstrap: 5 | ||
|
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
test_that("Basic unit tests for misc functions", { | ||
test_that("Basic unit tests for small misc functions", { | ||
expect_equal(misc_sanitizeNames("Climate-temperature2015"), "Climate_temperature2015") | ||
|
||
# Not in function\ | ||
lu <- c("Forest", "Cropland", "Wetland", "OtherLand") | ||
lu2 <- c("Forest", "Wetland", "otherland") | ||
test <- which(lu %notin% lu2) | ||
expect_equal(test, c(2,4)) | ||
}) |