diff --git a/.Rbuildignore b/.Rbuildignore index 517d35b1..2580df4f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,18 +1,15 @@ -^CRAN-RELEASE$ -^.*\.Rproj$ -^\.Rproj\.user$ -^README.*$ -^cran-comments\.md$ -^docs$ -^CODE_OF_CONDUCT.*$ -^vignettes/articles$ +codecov.yml +codemeta.json +CODE_OF_CONDUCT.md +CONTRIBUTING.md +cran-comments.md +data-raw +docs +LICENSE.md +pkgdown +README.Rmd +README.md +shar.Rproj vignettes/articles -^data-raw$ -^_pkgdown\.yml$ -^codecov\.yml$ -^CONTRIBUTING.*$ -^pkgdown$ -^\.github$ -^LICENSE\.md$ -^CRAN-SUBMISSION$ -^CODE_OF_CONDUCT\.md$ +.github +_pkgdown.yml diff --git a/.github/workflows/Deploy-pkgdown.yaml b/.github/workflows/Deploy-pkgdown.yaml index c3e11fb8..7d17728f 100644 --- a/.github/workflows/Deploy-pkgdown.yaml +++ b/.github/workflows/Deploy-pkgdown.yaml @@ -1,8 +1,10 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Workflow derived from https://github.com/r-lib/actions/tree/v2-branch/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help + on: push: branches: [main, development] + tags: ['*'] workflow_dispatch: name: deploy-pkgdown @@ -10,26 +12,30 @@ name: deploy-pkgdown jobs: deploy-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 }} + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - extra-repositories: 'http://packages.ropensci.org' - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::pkgdown, local::. + extra-packages: any::pkgdown, any::ggplot2, any::future, any::future.apply, + any::patchwork, any::rgbif, any::rgdal, any::rnaturalearth, + any::rnaturalearthdata, any::sf, local::. needs: website + - name: Install getCRUCLdata + run: install.packages('getCRUCLdata', repos = 'http://packages.ropensci.org', typ = 'source') + shell: Rscript {0} + - name: Build site run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 3306d062..f451f41c 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,10 +1,11 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Workflow derived from https://github.com/r-lib/actions/tree/v2-branch/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: branches: [CRAN, main, development] pull_request: branches: [CRAN, main] + workflow_dispatch: name: r-cmd-check @@ -12,7 +13,6 @@ jobs: r-cmd-check: if: "!contains(github.event.commits[0].message, '[skip-ci]')" runs-on: ${{ matrix.config.os }} - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) strategy: @@ -28,7 +28,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 @@ -37,7 +37,6 @@ jobs: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - extra-repositories: 'http://packages.ropensci.org' - uses: r-lib/actions/setup-r-dependencies@v2 with: diff --git a/.github/workflows/Render-README.yaml b/.github/workflows/Render-README.yaml index eaf1b89d..da0378f0 100644 --- a/.github/workflows/Render-README.yaml +++ b/.github/workflows/Render-README.yaml @@ -1,35 +1,39 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Workflow derived from https://github.com/r-lib/actions/tree/v2-branch/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - paths: ['README.Rmd'] + paths: ["README.Rmd"] + workflow_dispatch: -name: render-rmarkdown +name: render-readme jobs: - render-rmarkdown: + render-readme: runs-on: ubuntu-latest + env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 with: - extra-repositories: 'http://packages.ropensci.org' + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rmarkdown, any::spatstat, any::terra - - uses: r-lib/actions/setup-renv@v2 + - name: Render README files + run: Rscript -e 'rmarkdown::render("README.Rmd")' - - name: Render Rmarkdown files and Commit Results + - name: Commit README run: | - RMD_PATH=($(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '[.]Rmd$')) - Rscript -e 'for (f in commandArgs(TRUE)) if (file.exists(f)) rmarkdown::render(f)' ${RMD_PATH[*]} git config --local user.name "$GITHUB_ACTOR" git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - git commit ${RMD_PATH[*]/.Rmd/.md} -m 'Re-build Rmarkdown files' || echo "No changes to commit" + git add README.md man/figures/README-* + git commit -m "Re-build README.md" || echo "No changes to commit" git push origin || echo "No changes to commit" diff --git a/.github/workflows/Test-coverage.yaml b/.github/workflows/Test-coverage.yaml index df617c11..5c024ceb 100644 --- a/.github/workflows/Test-coverage.yaml +++ b/.github/workflows/Test-coverage.yaml @@ -1,10 +1,11 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Workflow derived from https://github.com/r-lib/actions/tree/v2-branch/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: branches: [CRAN, main, development] pull_request: branches: [CRAN, main] + workflow_dispatch: name: test-coverage @@ -12,16 +13,16 @@ jobs: test-coverage: if: "!contains(github.event.commits[0].message, '[skip-ci]')" 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@v2 with: use-public-rspm: true - extra-repositories: 'http://packages.ropensci.org' - uses: r-lib/actions/setup-r-dependencies@v2 with: diff --git a/.github/workflows/Write-codemeta.yaml b/.github/workflows/Write-codemeta.yaml new file mode 100644 index 00000000..62865b87 --- /dev/null +++ b/.github/workflows/Write-codemeta.yaml @@ -0,0 +1,36 @@ +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help + +on: + push: + paths: ['DESCRIPTION'] + workflow_dispatch: + +name: write-codemeta + +jobs: + write-codemeta: + runs-on: ubuntu-latest + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install codemeta + run: Rscript -e 'install.packages("codemeta")' + + - name: Write codemeta file + run: Rscript -e 'codemeta::write_codemeta()' + + - name: Commit codemeta file + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add codemeta.json + git commit -m "Re-write codemeta.json" || echo "No changes to commit" + git push origin || echo "No changes to commit" diff --git a/DESCRIPTION b/DESCRIPTION index 397e680a..f3d1eb84 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: shar Title: Species-Habitat Associations -Version: 2.0.0 -Authors@R: c(person("Maximillian H.K.", "Hesselbarth", email = "mhk.hesselbarth@gmail.com", +Version: 2.0.1 +Authors@R: c(person("Maximilian H.K.", "Hesselbarth", email = "mhk.hesselbarth@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1125-9918")), person("Marco", "Sciaini", email = "marco.sciaini@posteo.net", role = "aut", comment = c(ORCID = "0000-0002-3042-5435")), @@ -11,7 +11,7 @@ Authors@R: c(person("Maximillian H.K.", "Hesselbarth", email = "mhk.hesselbarth@ person("Thomas", "Etherington", email = "teth001@aucklanduni.ac.nz", role = "ctb", comment = c(ORCID = "0000-0002-3187-075X")) ) -Maintainer: Maximillian H.K. Hesselbarth +Maintainer: Maximilian H.K. Hesselbarth Description: Analyse species-habitat associations in R. Therefore, information about the location of the species (as a point pattern) is needed together with environmental conditions @@ -37,18 +37,8 @@ RoxygenNote: 7.2.1 Suggests: covr, dplyr, - getCRUCLdata, - ggplot2, - future, - future.apply, knitr, - patchwork, - rgbif, - rgdal, rmarkdown, - rnaturalearth, - rnaturalearthdata, - sf, spatstat (>= 2.0.0), testthat (>= 2.1.0) Additional_repositories: http://packages.ropensci.org diff --git a/NEWS.md b/NEWS.md index 25f70646..d5eca03e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# shar 2.0.1 +* Improvements + * Better approach for external repo +* Various + * Fixing typo in maintainer name + # shar 2.0.0 * Improvements * Using `terra` instead of `raster` diff --git a/R/onLoad.R b/R/onLoad.R deleted file mode 100644 index 28e7b476..00000000 --- a/R/onLoad.R +++ /dev/null @@ -1,11 +0,0 @@ -.onLoad <- function(libname, pkgname) { - - repos <- getOption("repos") - - repos["getCRUCLdata"] <- "http://packages.ropensci.org" - - options(repos = repos) - - invisible(repos) - -} diff --git a/README.Rmd b/README.Rmd index 4b3688fb..be07cdc2 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,5 +1,7 @@ --- -output: github_document +output: + github_document: + html_preview: false --- @@ -15,6 +17,8 @@ knitr::opts_chunk$set( +Last updated: `r Sys.Date()` + | CI | Development | CRAN | License | |----|-------------|------|---------| | [![R-CMD-check](https://github.com/r-spatialecology/shar/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-spatialecology/shar/actions/workflows/R-CMD-check.yaml) | [![Project Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) | [![CRAN status](https://www.r-pkg.org/badges/version/shar)](https://cran.r-project.org/package=shar) |[![JOSS](https://joss.theoj.org/papers/1b786c028a5425858cb0e5428bd9173b/status.svg)](https://joss.theoj.org/papers/1b786c028a5425858cb0e5428bd9173b) | @@ -43,8 +47,7 @@ install.packages("shar") And the development version from [GitHub](https://github.com/r-spatialecology/shar) with: ```{r install-github, eval = FALSE} -install.packages("remotes") - +# install.packages("remotes") remotes::install_github("r-spatialecology/shar") ``` @@ -98,7 +101,7 @@ Of course, there are several utility functions. For example, you can plot the su plot(reconstruction, what = "pp") ``` -Another utility functions allows to calculate the differences between the observed pattern and the randomized patterns (also called energy using summary functions). +Another utility function allows to calculate the differences between the observed pattern and the randomized patterns (also called energy using summary functions). ```{r calculate-energy, message = FALSE} calculate_energy(reconstruction, return_mean = TRUE) @@ -114,7 +117,6 @@ Furthermore, please be aware that due to the randomization of the null model dat torus_trans <- unpack_randomized(torus_trans) ``` - ```{r results} significance_level <- 0.01 @@ -129,7 +131,7 @@ Contributions to **shar** are highly welcomed and appreciated. This includes any Please note that the **shar** package is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms. -To see how to contribute to this project, please see the [Contributing guidelines](CONTRIBUTING.md). +To contribute to this project, please see the [Contributing guidelines](CONTRIBUTING.md). ### References diff --git a/README.md b/README.md index a05e176a..8b5e6bcb 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ -# **shar** | **S**pecies **h**abitat **a**ssociations in **R** +# **shar** \| **S**pecies **h**abitat **a**ssociations in **R** +Last updated: 2022-11-01 + | CI | Development | CRAN | License | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| | [![R-CMD-check](https://github.com/r-spatialecology/shar/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-spatialecology/shar/actions/workflows/R-CMD-check.yaml) | [![Project Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) | [![CRAN status](https://www.r-pkg.org/badges/version/shar)](https://cran.r-project.org/package=shar) | [![JOSS](https://joss.theoj.org/papers/1b786c028a5425858cb0e5428bd9173b/status.svg)](https://joss.theoj.org/papers/1b786c028a5425858cb0e5428bd9173b) | | [![codecov](https://codecov.io/gh/r-spatialecology/shar/branch/main/graph/badge.svg?token=XMo844ABs4)](https://codecov.io/gh/r-spatialecology/shar) | [![Lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable) | [![CRAN logs](http://cranlogs.r-pkg.org/badges/grand-total/shar)](http://cran.rstudio.com/web/packages/shar/index.html) | [![License](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) | @@ -51,8 +53,7 @@ And the development version from [GitHub](https://github.com/r-spatialecology/shar) with: ``` r -install.packages("remotes") - +# install.packages("remotes") remotes::install_github("r-spatialecology/shar") ``` @@ -132,9 +133,9 @@ plot(reconstruction, what = "pp") -Another utility functions allows to calculate the differences between -the observed pattern and the randomized patterns (also called energy -using summary functions). +Another utility function allows to calculate the differences between the +observed pattern and the randomized patterns (also called energy using +summary functions). ``` r calculate_energy(reconstruction, return_mean = TRUE) @@ -155,11 +156,10 @@ other habitats. Furthermore, please be aware that due to the randomization of the null model data, results might slightly differ between different randomization approaches (e.g., `fit_point_process()` -vs. `translate_raster()`) and even for repetitions of the same -approach. Thus, the exact `lo` and `hi` thresholds might be slightly -different when re-running the examples. However, the counts of the -observed data should be identical, and general results and trends should -be similar. +vs. `translate_raster()`) and even for repetitions of the same approach. +Thus, the exact `lo` and `hi` thresholds might be slightly different +when re-running the examples. However, the counts of the observed data +should be identical, and general results and trends should be similar. ``` r significance_level <- 0.01 @@ -195,7 +195,7 @@ Please note that the **shar** package is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms. -To see how to contribute to this project, please see the [Contributing +To contribute to this project, please see the [Contributing guidelines](CONTRIBUTING.md). ### References diff --git a/_pkgdown.yml b/_pkgdown.yml index 3ecf9a72..db289d56 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -78,7 +78,7 @@ navbar: href: articles/publication_record.html - text: "JOSS Publication" icon: fa-file-text-o - href: inst/Hesselbarth_2021_Journal_of_Open_Source_Software_6_68.pdf + href: https://doi.org/10.21105/joss.03811 news: icon: fa-newspaper-o diff --git a/codemeta.json b/codemeta.json new file mode 100644 index 00000000..603f95a3 --- /dev/null +++ b/codemeta.json @@ -0,0 +1,263 @@ +{ + "@context": "https://doi.org/10.5063/schema/codemeta-2.0", + "@type": "SoftwareSourceCode", + "identifier": "shar", + "description": " Analyse species-habitat associations in R. Therefore, information about the location of the species (as a point pattern) is needed together with environmental conditions (as a categorical raster). To test for significance habitat associations, one of the two components is randomized. Methods are mainly based on Plotkin et al. (2000) and Harms et al. (2001) .", + "name": "shar: Species-Habitat Associations", + "codeRepository": "https://r-spatialecology.github.io/shar/", + "issueTracker": "https://github.com/r-spatialecology/shar/issues/", + "license": "https://spdx.org/licenses/GPL-3.0", + "version": "2.0.1", + "programmingLanguage": { + "@type": "ComputerLanguage", + "name": "R", + "url": "https://r-project.org" + }, + "runtimePlatform": "R version 4.2.2 (2022-10-31)", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "author": [ + { + "@type": "Person", + "givenName": "Maximilian H.K.", + "familyName": "Hesselbarth", + "email": "mhk.hesselbarth@gmail.com", + "@id": "https://orcid.org/0000-0003-1125-9918" + }, + { + "@type": "Person", + "givenName": "Marco", + "familyName": "Sciaini", + "email": "marco.sciaini@posteo.net", + "@id": "https://orcid.org/0000-0002-3042-5435" + } + ], + "contributor": [ + { + "@type": "Person", + "givenName": "Zeke", + "familyName": "Marshall", + "email": "ee18zm@leeds.ac.uk", + "@id": "https://orcid.org/0000-0001-9260-7827" + }, + { + "@type": "Person", + "givenName": "Thomas", + "familyName": "Etherington", + "email": "teth001@aucklanduni.ac.nz", + "@id": "https://orcid.org/0000-0002-3187-075X" + } + ], + "maintainer": [ + { + "@type": "Person", + "givenName": "Maximilian H.K.", + "familyName": "Hesselbarth", + "email": "mhk.hesselbarth@gmail.com", + "@id": "https://orcid.org/0000-0003-1125-9918" + } + ], + "softwareSuggestions": [ + { + "@type": "SoftwareApplication", + "identifier": "covr", + "name": "covr", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=covr" + }, + { + "@type": "SoftwareApplication", + "identifier": "dplyr", + "name": "dplyr", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=dplyr" + }, + { + "@type": "SoftwareApplication", + "identifier": "knitr", + "name": "knitr", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=knitr" + }, + { + "@type": "SoftwareApplication", + "identifier": "rmarkdown", + "name": "rmarkdown", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=rmarkdown" + }, + { + "@type": "SoftwareApplication", + "identifier": "spatstat", + "name": "spatstat", + "version": ">= 2.0.0", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=spatstat" + }, + { + "@type": "SoftwareApplication", + "identifier": "testthat", + "name": "testthat", + "version": ">= 2.1.0", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=testthat" + } + ], + "softwareRequirements": { + "1": { + "@type": "SoftwareApplication", + "identifier": "R", + "name": "R", + "version": ">= 3.1.0" + }, + "2": { + "@type": "SoftwareApplication", + "identifier": "classInt", + "name": "classInt", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=classInt" + }, + "3": { + "@type": "SoftwareApplication", + "identifier": "graphics", + "name": "graphics" + }, + "4": { + "@type": "SoftwareApplication", + "identifier": "grDevices", + "name": "grDevices" + }, + "5": { + "@type": "SoftwareApplication", + "identifier": "methods", + "name": "methods" + }, + "6": { + "@type": "SoftwareApplication", + "identifier": "spatstat.core", + "name": "spatstat.core", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=spatstat.core" + }, + "7": { + "@type": "SoftwareApplication", + "identifier": "spatstat.geom", + "name": "spatstat.geom", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=spatstat.geom" + }, + "8": { + "@type": "SoftwareApplication", + "identifier": "spatstat.random", + "name": "spatstat.random", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=spatstat.random" + }, + "9": { + "@type": "SoftwareApplication", + "identifier": "stats", + "name": "stats" + }, + "10": { + "@type": "SoftwareApplication", + "identifier": "terra", + "name": "terra", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=terra" + }, + "11": { + "@type": "SoftwareApplication", + "identifier": "utils", + "name": "utils" + }, + "SystemRequirements": null + }, + "fileSize": "1016.53KB", + "citation": [ + { + "@type": "ScholarlyArticle", + "datePublished": "2021", + "author": [ + { + "@type": "Person", + "givenName": ["Maximilian", "H.K."], + "familyName": "Hesselbarth" + } + ], + "name": "shar: A R package to analyze species-habitat associations using point pattern analysis", + "identifier": "10.21105/joss.03811", + "pagination": "3811", + "@id": "https://doi.org/10.21105/joss.03811", + "sameAs": "https://doi.org/10.21105/joss.03811", + "isPartOf": { + "@type": "PublicationIssue", + "issueNumber": "67", + "datePublished": "2021", + "isPartOf": { + "@type": ["PublicationVolume", "Periodical"], + "volumeNumber": "6", + "name": "Journal of Open Source Software" + } + } + } + ] +} diff --git a/cran-comments.md b/cran-comments.md index 869fa71f..89e8b889 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,5 +1,8 @@ For details changes, please see NEWS.md. +## shar 2.0.1 +Fixing external repo, typo maintainer name + ## shar 2.0.0 * Replace `raster` with `terra` and several code changes related to this * Fixed issue of earlier submission "Unknown, possibly misspelled, fields in DESCRIPTION: 'Remotes'" diff --git a/inst/Hesselbarth_2021_Journal_of_Open_Source_Software_6_68.pdf b/inst/Hesselbarth_2021_Journal_of_Open_Source_Software_6_68.pdf deleted file mode 100644 index 776c66ab..00000000 Binary files a/inst/Hesselbarth_2021_Journal_of_Open_Source_Software_6_68.pdf and /dev/null differ diff --git a/man/figures/README-plot-random_pattern-1.png b/man/figures/README-plot-random_pattern-1.png index aabfbb2b..537b3188 100644 Binary files a/man/figures/README-plot-random_pattern-1.png and b/man/figures/README-plot-random_pattern-1.png differ diff --git a/man/shar.Rd b/man/shar.Rd index abe5298d..5a1fed5e 100644 --- a/man/shar.Rd +++ b/man/shar.Rd @@ -21,7 +21,7 @@ Useful links: } \author{ -\strong{Maintainer}: Maximillian H.K. Hesselbarth \email{mhk.hesselbarth@gmail.com} (\href{https://orcid.org/0000-0003-1125-9918}{ORCID}) +\strong{Maintainer}: Maximilian H.K. Hesselbarth \email{mhk.hesselbarth@gmail.com} (\href{https://orcid.org/0000-0003-1125-9918}{ORCID}) Authors: \itemize{ diff --git a/vignettes/articles/cormus_domestica_tmp.Rmd b/vignettes/articles/cormus_domestica_tmp.Rmd index 3a523b9b..4e4d21b2 100644 --- a/vignettes/articles/cormus_domestica_tmp.Rmd +++ b/vignettes/articles/cormus_domestica_tmp.Rmd @@ -18,12 +18,30 @@ knitr::opts_chunk$set( ) ``` +```{r, echo = FALSE} +check_pkgs <- requireNamespace("getCRUCLdata", quietly = TRUE) + +if (!check_pkgs) { + + message <- paste("This article of the package requires the 'getCRUCLdata' package", + "which is not available on CRAN anymore. To install the package, please", + "run 'install.packages('getCRUCLdata', repos = 'http://packages.ropensci.org', typ = 'source')'.") + + message <- paste(strwrap(message), collapse = "\n") + + message(message) + +} +``` + ## Outline This vignette demonstrates how to use `shar` to analyse species occurrence data obtained from the Global Biodiversity Information Facility [(GBIF)](https://www.gbif.org) and environmental raster data obtained from the Climate Research Unit [(CRU)](https://www.uea.ac.uk/groups-and-centres/climatic-research-unit) entirely in `R`. The "Gamma test" approach as detailed in the `vignette("background")` is used. The distribution of the tree species *Cormus domestica* in Europe is selected, a tree which tolerates a wide range of conditions but favors warm to mild climates, occurring in the "Subtropical dry forest" and "Temperate Continental" FAO ecological zones. *Cormus domestica* is most commonly found in Southern Europe, though there it's natural range is uncertain owing to it's cultivation and distribution by the Roman Empire (De Rigo et al., 2016; Rotach, 2003). ## Load required packages +This article of the package requires the `getCRUCLdata` package, which is not available on CRAN anymore. To install the package, please run `install.packages('getCRUCLdata', repos = 'http://packages.ropensci.org', typ = 'source')`. + ```{r packages, message=FALSE, warning=FALSE} library(dplyr) # For data wrangling library(getCRUCLdata) # For retrieving climate raster data @@ -40,11 +58,7 @@ library(shar) # For species-habitat association analysis ## Download occurrence data -To retrieve species occurrence data the `R` package `rgbif` (Chamberlain & -Boettiger, 2017) is used, which provides an interface to access the GBIF -database. For this vignette we are interested in observations within -the likely natural distribution of Cormus domestica, which includes Europe, the -wider Mediterranean, the Black Sea Region, and potentially North Africa. +To retrieve species occurrence data the `R` package `rgbif` (Chamberlain & Boettiger, 2017) is used, which provides an interface to access the GBIF database. For this vignette we are interested in observations within the likely natural distribution of Cormus domestica, which includes Europe, the wider Mediterranean, the Black Sea Region, and potentially North Africa. ```{r gbif, echo=FALSE, eval=TRUE, message=FALSE, warning=FALSE} # Load bundled GBIF occurrence data @@ -120,11 +134,7 @@ tmp_raster <- cru_data$tmp$jan ## Prepare landscape raster -The climate data obtained above is restricted to the region of interest, -then classified into 10 habitats based on temperature ranges, -achieved by setting the lower and upper bounds of these ranges -in the `fixedBreaks` argument of the `classify_habitats` function. -Figure 1 displays the unclassified and classified habitat. +The climate data obtained above is restricted to the region of interest, then classified into 10 habitats based on temperature ranges, achieved by setting the lower and upper bounds of these ranges in the `fixedBreaks` argument of the `classify_habitats` function. Figure 1 displays the unclassified and classified habitat. ```{r landscape_ras, echo=TRUE, message=FALSE, warning=FALSE} # Crop tmp raster @@ -430,14 +440,7 @@ plot_res_classed_occs <- ggplot2::ggplot() + plot_res_classed + plot_res_classed_occs ``` -By visually inspecting Figure 3 we can see that occurrences of *Cormus domestica* -are mostly restricted to the associated habitat as defined by a mean January -temperature of -2.5C - 10C. -However, *Cormus domestica* does not exist in all areas experiencing a mean January -temperature of -2.5C - 10C, additionally there are a number of occurrences -outside these areas. The next step assessing in the climatic niche of *Cormus domestica* -would be to repeat the above analysis for more environmental variables, -which is beyond the scope of this minimal example. +By visually inspecting Figure 3 we can see that occurrences of *Cormus domestica* are mostly restricted to the associated habitat as defined by a mean January temperature of -2.5C - 10C. However, *Cormus domestica* does not exist in all areas experiencing a mean January temperature of -2.5C - 10C, additionally there are a number of occurrences outside these areas. The next step assessing in the climatic niche of *Cormus domestica* would be to repeat the above analysis for more environmental variables, which is beyond the scope of this minimal example. ## References