diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..bfc9f4d --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -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/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/DESCRIPTION b/DESCRIPTION index e17eef6..3f08042 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,7 +13,7 @@ Authors@R: ) Description: What the package does (one paragraph). License: MIT + file LICENSE -URL: https://github.com/iiasa/BNRTools +URL: https://github.com/iiasa/BNRTools, https://iiasa.github.io/BNRTools/ BugReports: https://github.com/iiasa/BNRTools/issues Depends: R (>= 3.6) Imports: diff --git a/NAMESPACE b/NAMESPACE index a74b708..29a6e11 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,5 @@ # Generated by roxygen2: do not edit by hand export(misc_sanitizeNames) +export(sp_replaceGriddedNA) export(sp_resampleRas) -export(sp_replaceGriddedNA) \ No newline at end of file diff --git a/R/spl_replaceGriddedNA.R b/R/spl_replaceGriddedNA.R index d4302fb..1e06d5c 100644 --- a/R/spl_replaceGriddedNA.R +++ b/R/spl_replaceGriddedNA.R @@ -17,10 +17,10 @@ #' #' @examples #' # Example -#' s <- rast(system.file("ex/logo.tif", package="terra")) +#' s <- terra::rast(system.file("ex/logo.tif", package="terra")) #' s[sample(1:terra::ncell(s), 100)] <- NA #' sfill <- sp_replaceGriddedNA(s, value = 100) -#' plot(sfill) +#' terra::plot(sfill) #' #' @returns A object of the same type as the input but with no-data values replaced with \code{'value'}. #' @author Martin Jung diff --git a/README.md b/README.md index 5563b18..cf52678 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,37 @@ See this [website](https://r-pkgs.org/) for more general help and examples in de ## Code of Conduct Please note that the BNRTools project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms. + +## Contributors + + + + + + + +All contributions to this project are gratefully acknowledged using the [`allcontributors` package](https://github.com/ropensci/allcontributors) following the [all-contributors](https://allcontributors.org) specification. Contributions of any kind are welcome! + + + + + + + + +
+ + +
+Martin-Jung +
+ + +
+mhesselbarth +
+ + + + + diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..ead1603 --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,4 @@ +url: https://iiasa.github.io/BNRTools/ +template: + bootstrap: 5 + diff --git a/man/sp_replaceGriddedNA.Rd b/man/sp_replaceGriddedNA.Rd index 386436b..207968d 100644 --- a/man/sp_replaceGriddedNA.Rd +++ b/man/sp_replaceGriddedNA.Rd @@ -16,7 +16,7 @@ sp_replaceGriddedNA(obj, value = 0, mask, verbose = FALSE) \item{verbose}{Be chatty about what is processed (Default: \code{FALSE}).} } \value{ -A object of the same type as the input but with no-data values replaced with \code{0}. +A object of the same type as the input but with no-data values replaced with \code{'value'}. } \description{ This function replaces all NA values in a spatial gridded layer with @@ -30,8 +30,10 @@ all no-data values a replaced with the value in this mask. } \examples{ # Example -s <- rast(system.file("ex/logo.tif", package="terra")) -s[] +s <- terra::rast(system.file("ex/logo.tif", package="terra")) +s[sample(1:terra::ncell(s), 100)] <- NA +sfill <- sp_replaceGriddedNA(s, value = 100) +terra::plot(sfill) } \author{