Skip to content

Commit

Permalink
Merge pull request #8 from ropensci/joelnitta/issue7
Browse files Browse the repository at this point in the history
Joelnitta/issue7
  • Loading branch information
joelnitta authored Sep 18, 2022
2 parents 6a9412e + 6c54015 commit 07bde1c
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 65 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: canaper
Title: Categorical Analysis of Neo- And Paleo-Endemism
Version: 0.0.2
Version: 0.0.3
Authors@R:
c(
person(given = "Joel H.",
Expand Down Expand Up @@ -29,9 +29,9 @@ Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE, roclets = c ("collate", "namespace", "rd", "roxyglobals::global_roclet", "srr::srr_stats_roclet"))
RoxygenNote: 7.2.1
URL: https://github.com/joelnitta/canaper,
https://joelnitta.github.io/canaper/
BugReports: https://github.com/joelnitta/canaper/issues
URL: https://github.com/ropensci/canaper,
https://docs.ropensci.org/canaper/
BugReports: https://github.com/ropensci/canaper/issues
Imports:
ape,
assertr,
Expand Down
38 changes: 33 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,60 @@
canaper 0.0.3
===============

Includes improvements in response to review on ropensci (https://github.com/ropensci/software-review/issues/475)
### DOCUMENTATION

* Update README with comparisons to other packages (d8aaf8de5193166d52ab890d8267090ea2f8ef6a)

* Add link to CONTRIBUTING.md to README (d8aaf8de5193166d52ab890d8267090ea2f8ef6a)

* Change Depends: R (>= 3.5.0) to Depends: R (>= 4.1.0) in DESCRIPTION (0f334965fb5a3fe5034eb1bc682b5051548eddb1)

* Add @KlausVigo as reviewer to DESCRIPTION (6e9b3d55202e2294a6436280ca6b01db13d92974)

### BUG FIXES

* Delete redundant checks in internal functions (bccd0278dd3de5853680d9979ca26c1aa38a7fb3)

### TESTS

* Make skipping of extended tests default (https://github.com/joelnitta/canaper/blob/76c277490dcecd0f32df351c48c8f8c891674aad/tests/testthat/test-cpr_rand_test.R#L395)

* Decrease number of replicates so tests finish faster (12bbe36bf5516a2a63c1235c76234708c4c5432d, f3af4671d679020aeaa97b1a038b3b5a96633f42)

### OTHER

* Import functions from phyloregion instead of copying (7e8b24950912bfa2a5e10cf4dd9cfa8910d74e76)

canaper 0.0.2
===============

### BUG FIXES

* [Fix bug](https://github.com/joelnitta/canaper/commit/acb40172c2d5ffb04e13519c6cad7c6d00fa451a) where `cpr_rand_test()` was failing to return identical results after `set.seed()` when parallelization is on
* [Fix bug](https://github.com/ropensci/canaper/commit/acb40172c2d5ffb04e13519c6cad7c6d00fa451a) where `cpr_rand_test()` was failing to return identical results after `set.seed()` when parallelization is on

canaper 0.0.1
===============

### NEW FEATURES

* [Add `cpr_rand_comm()` function](https://github.com/joelnitta/canaper/commit/2f3318c1d62f401d7c99bdcc16c64194359c3fbe) for generating a random community
* [Add `cpr_rand_comm()` function](https://github.com/ropensci/canaper/commit/2f3318c1d62f401d7c99bdcc16c64194359c3fbe) for generating a random community

* Implement user-provided community matrix randomization functions

### BREAKING CHANGES

* [Use `vegan`](https://github.com/joelnitta/canaper/commit/b0a2d47130398eb62e28eba4783057f781763645) for community matrix randomizations instead of `picante`
* [Use `vegan`](https://github.com/ropensci/canaper/commit/b0a2d47130398eb62e28eba4783057f781763645) for community matrix randomizations instead of `picante`


### BUG FIXES

* [Fix error](https://github.com/joelnitta/canaper/commit/2f3318c1d62f401d7c99bdcc16c64194359c3fbe) in classification of endemism types with `cpr_classify_endem()`,
* [Fix error](https://github.com/ropensci/canaper/commit/2f3318c1d62f401d7c99bdcc16c64194359c3fbe) in classification of endemism types with `cpr_classify_endem()`,
where super-endemic cells were previously being assigned if `pe_obs_p_upper`
**or** `pe_obs_alt_p_upper` were highly significant (P > 0.99), to requiring
**both** to be highly significant

* [Fix calculation](https://github.com/joelnitta/canaper/commit/50ed6e975d14adba334f06a984d521ff69ed961c) of RPD, RPE where alternative tree had all branch lengths
* [Fix calculation](https://github.com/ropensci/canaper/commit/50ed6e975d14adba334f06a984d521ff69ed961c) of RPD, RPE where alternative tree had all branch lengths
converted to same value, to converting only non-zero branch lengths to same
value

Expand Down
30 changes: 16 additions & 14 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,32 @@ knitr::opts_chunk$set(

<!-- badges: start -->
[![DOI](https://zenodo.org/badge/359280907.svg)](https://zenodo.org/badge/latestdoi/359280907)
[![R-CMD-check](https://github.com/joelnitta/canaper/workflows/R-CMD-check/badge.svg)](https://github.com/joelnitta/canaper/actions)
[![R-CMD-check](https://github.com/ropensci/canaper/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/canaper/actions)
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![Codecov test coverage](https://codecov.io/gh/joelnitta/canaper/branch/main/graph/badge.svg)](https://codecov.io/gh/joelnitta/canaper?branch=main)
[![Codecov test coverage](https://codecov.io/gh/ropensci/canaper/branch/main/graph/badge.svg)](https://codecov.io/gh/ropensci/canaper?branch=main)
<!-- badges: end -->

```{r srr-tags-intro, eval = FALSE, echo = FALSE}
#' @srrstats {G1.1} documents novelty
```

The goal of canaper is to enable [categorical analysis of neo- and paleo-endemism (CANAPE)](https://doi.org/10.1038/ncomms5473) in **R**. This is the first implementation in **R** of CANAPE, which was previously only available in [Biodiverse](http://shawnlaffan.github.io/biodiverse/).
The goal of `canaper` is to enable [categorical analysis of neo- and paleo-endemism (CANAPE)](https://doi.org/10.1038/ncomms5473) in **R**. This is the first implementation in **R** of CANAPE, which was previously only available in [Biodiverse](http://shawnlaffan.github.io/biodiverse/).

## Important note
## Installation

**This package is in early development.** There may be major, breaking changes to functionality in the near future. If you use this package, I highly recommend using a package manager like [renv](https://rstudio.github.io/renv/articles/renv.html) so that later updates won't break your code.
`canaper` is not currently available on CRAN.

## Installation
You can install `canaper` from [r-universe](https://r-universe.dev) with:

You can install canaper from [GitHub](https://github.com/) with:
``` r
install.packages("canaper", repos = "https://ropensci.r-universe.dev")
```

or, you can install `canaper` from [GitHub](https://github.com/) with:

``` r
# install.packages("remotes")
remotes::install_github("joelnitta/canaper")
remotes::install_github("ropensci/canaper")
```

## Example usage
Expand Down Expand Up @@ -105,7 +109,7 @@ This data set is very small, so it doesn't include all possible endemism types.
- `mixed`: mixture of both paleo and neo
- `super`: mixed and highly significant (*p* < 0.01)

For a more complete example, please [see the vignette](https://joelnitta.github.io/canaper/articles/canape.html)
For a more complete example, please [see the vignette](https://docs.ropensci.org/canaper/articles/canape.html)

## Comparsion with other software

Expand All @@ -128,9 +132,7 @@ Poster at [Botany 2021](https://2021.botanyconference.org/)

If you use this package, please cite it! Here is an example:

```
Nitta JH, Laffan SW, Mishler BD, Iwasaki W. (2021) canaper: Categorical analysis of neo- and paleo-endemism in R. doi: 10.5281/zenodo.5094032
```
- Nitta JH, Laffan SW, Mishler BD, Iwasaki W. (2021) canaper: Categorical analysis of neo- and paleo-endemism in R. doi: 10.5281/zenodo.5094032

The example DOI above is for the overall package.

Expand All @@ -156,8 +158,8 @@ Please note that this package is released with a [Contributor Code of Conduct](h

- Code: [MIT](LICENSE.md)
- Example datasets
- `acacia`, `biod_example`: [GNU General Public License v3.0](https://github.com/joelnitta/canaper/blob/main/data-raw/LICENSE-gpl.txt)
- `phylocom`: [BSD-3-Clause](https://github.com/joelnitta/canaper/blob/main/data-raw/LICENSE-bsd3.txt)
- `acacia`, `biod_example`: [GNU General Public License v3.0](https://github.com/ropensci/canaper/blob/main/data-raw/LICENSE-gpl.txt)
- `phylocom`: [BSD-3-Clause](https://github.com/ropensci/canaper/blob/main/data-raw/LICENSE-bsd3.txt)

## References

Expand Down
39 changes: 22 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,38 @@
<!-- badges: start -->

[![DOI](https://zenodo.org/badge/359280907.svg)](https://zenodo.org/badge/latestdoi/359280907)
[![R-CMD-check](https://github.com/joelnitta/canaper/workflows/R-CMD-check/badge.svg)](https://github.com/joelnitta/canaper/actions)
[![R-CMD-check](https://github.com/ropensci/canaper/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/canaper/actions)
[![Project Status: WIP – Initial development is in progress, but there
has not yet been a stable, usable release suitable for the
public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![Codecov test
coverage](https://codecov.io/gh/joelnitta/canaper/branch/main/graph/badge.svg)](https://codecov.io/gh/joelnitta/canaper?branch=main)
coverage](https://codecov.io/gh/ropensci/canaper/branch/main/graph/badge.svg)](https://codecov.io/gh/ropensci/canaper?branch=main)
<!-- badges: end -->

The goal of canaper is to enable [categorical analysis of neo- and
The goal of `canaper` is to enable [categorical analysis of neo- and
paleo-endemism (CANAPE)](https://doi.org/10.1038/ncomms5473) in **R**.
This is the first implementation in **R** of CANAPE, which was
previously only available in
[Biodiverse](http://shawnlaffan.github.io/biodiverse/).

## Important note

**This package is in early development.** There may be major, breaking
changes to functionality in the near future. If you use this package, I
highly recommend using a package manager like
[renv](https://rstudio.github.io/renv/articles/renv.html) so that later
updates won’t break your code.

## Installation

You can install canaper from [GitHub](https://github.com/) with:
`canaper` is not currently available on CRAN.

You can install `canaper` from [r-universe](https://r-universe.dev)
with:

``` r
install.packages("canaper", repos = "https://ropensci.r-universe.dev")
```

or, you can install `canaper` from [GitHub](https://github.com/) with:

``` r
# install.packages("remotes")
remotes::install_github("joelnitta/canaper")
remotes::install_github("ropensci/canaper")
```

## Example usage
Expand Down Expand Up @@ -162,7 +165,7 @@ types. In total, they include:
- `super`: mixed and highly significant (*p* \< 0.01)

For a more complete example, please [see the
vignette](https://joelnitta.github.io/canaper/articles/canape.html)
vignette](https://docs.ropensci.org/canaper/articles/canape.html)

## Comparsion with other software

Expand All @@ -186,12 +189,12 @@ comprehensive description of each package.
`frequency`, `richness`, `independentswap`, and `trialswap`.
- [vegan](https://github.com/vegandevs/vegan): Performs a large range
of mostly non-phylogenetic diversity analyses. Includes the largest
selection of null models (\> 20), according to data type (binary
selection of null models (> 20), according to data type (binary
vs. quantitative). `canaper` uses `vegan` to randomize community
matrices.
- [biodiverse](http://shawnlaffan.github.io/biodiverse/): Not an R
package, but software written in perl with a GUI. Performs all of
the calculations needed for CANAPE, and many other metrics (\> 300).
the calculations needed for CANAPE, and many other metrics (> 300).
Includes `rand_structured` null model as well as spatially
structured null models. None of these null models are currently
available in any R packages AFAIK, except for `independentswap`.
Expand All @@ -207,7 +210,9 @@ Poster at [Botany 2021](https://2021.botanyconference.org/)

If you use this package, please cite it! Here is an example:

Nitta JH, Laffan SW, Mishler BD, Iwasaki W. (2021) canaper: Categorical analysis of neo- and paleo-endemism in R. doi: 10.5281/zenodo.5094032
- Nitta JH, Laffan SW, Mishler BD, Iwasaki W. (2021) canaper:
Categorical analysis of neo- and paleo-endemism in R. doi:
10.5281/zenodo.5094032

The example DOI above is for the overall package.

Expand Down Expand Up @@ -247,9 +252,9 @@ project, you agree to abide by its terms.
- Code: [MIT](LICENSE.md)
- Example datasets
- `acacia`, `biod_example`: [GNU General Public License
v3.0](https://github.com/joelnitta/canaper/blob/main/data-raw/LICENSE-gpl.txt)
v3.0](https://github.com/ropensci/canaper/blob/main/data-raw/LICENSE-gpl.txt)
- `phylocom`:
[BSD-3-Clause](https://github.com/joelnitta/canaper/blob/main/data-raw/LICENSE-bsd3.txt)
[BSD-3-Clause](https://github.com/ropensci/canaper/blob/main/data-raw/LICENSE-bsd3.txt)

## References

Expand Down
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: https://joelnitta.github.io/canaper/
url: https://docs.ropensci.org/canaper/
home:
title: Categorical Analysis of Neo- and Paleo-endemism in R
description: |
Expand Down
20 changes: 9 additions & 11 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"identifier": "canaper",
"description": "Provides functions to conduct categorical analysis of neo- and paleo-endemism (CANAPE).",
"name": "canaper: Categorical Analysis of Neo- And Paleo-Endemism",
"relatedLink": "https://joelnitta.github.io/canaper/",
"codeRepository": "https://github.com/joelnitta/canaper",
"issueTracker": "https://github.com/joelnitta/canaper/issues",
"relatedLink": "https://docs.ropensci.org/canaper/",
"codeRepository": "https://github.com/ropensci/canaper",
"issueTracker": "https://github.com/ropensci/canaper/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.0.2",
"version": "0.0.3",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -385,7 +385,7 @@
},
"SystemRequirements": null
},
"fileSize": "9237.93KB",
"fileSize": "280.144KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand All @@ -404,14 +404,12 @@
],
"name": "canaper: Categorical analysis of neo- and paleo-endemism in {R}",
"identifier": "10.5281/zenodo.5094032",
"url": "https://github.com/joelnitta/canaper",
"url": "https://github.com/ropensci/canaper",
"@id": "https://doi.org/10.5281/zenodo.5094032",
"sameAs": "https://doi.org/10.5281/zenodo.5094032"
}
],
"releaseNotes": "https://github.com/joelnitta/canaper/blob/master/NEWS.md",
"readme": "https://github.com/joelnitta/canaper/blob/main/README.md",
"contIntegration": ["https://github.com/joelnitta/canaper/actions", "https://codecov.io/gh/joelnitta/canaper?branch=main"],
"developmentStatus": "https://www.repostatus.org/#wip",
"keywords": ["biodiversity", "canape"]
"releaseNotes": "https://github.com/ropensci/canaper/blob/master/NEWS.md",
"contIntegration": ["https://github.com/ropensci/canaper/actions", "https://codecov.io/gh/ropensci/canaper?branch=main"],
"developmentStatus": "https://www.repostatus.org/#wip"
}
4 changes: 2 additions & 2 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
citHeader("This is how you can cite canaper in publications (please replace the DOI below with the one matching the version in use; for more information, see the README at https://github.com/joelnitta/canaper)")
citHeader("This is how you can cite canaper in publications (please replace the DOI below with the one matching the version in use; for more information, see the README at https://github.com/ropensci/canaper)")

citEntry(
entry = "Manual",
Expand All @@ -7,7 +7,7 @@ citEntry(
as.person("Wataru Iwasaki")
),
year = "2021",
url = "https://github.com/joelnitta/canaper",
url = "https://github.com/ropensci/canaper",
doi = "10.5281/zenodo.5094032",
textVersion = paste("Nitta JH, Iwasaki W. (2021) canaper: Categorical analysis of neo- and paleo-endemism in R. doi: 10.5281/zenodo.5094032")
)
6 changes: 6 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ branchlengths
BugReports
canaper
centroids
citEntry
citHeader
CMD
cmd
Codecov
Expand Down Expand Up @@ -84,6 +86,7 @@ io
issueTracker
Iwasaki
JamesIves
JH
joelnitta
Kembel
Knerr
Expand Down Expand Up @@ -132,6 +135,7 @@ params
parellelization
pc
perl
personList
phangorn
phylo
Phylocom
Expand Down Expand Up @@ -162,6 +166,7 @@ reprex
rmarkdown
roclet
roclets
ropensci
Rosauer
Roxygen
roxygen
Expand Down Expand Up @@ -194,6 +199,7 @@ Sublicensing
sudo
SystemRequirements
testthat
textVersion
tibble
tictoc
tidyverse
Expand Down
6 changes: 3 additions & 3 deletions man/canaper-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vignettes/canape.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ The main purpose of `canaper` is to perform these randomization tests.

`canaper` generates random communities using the [`vegan` package](https://CRAN.R-project.org/package=vegan). There are a large number of pre-defined randomization algorithms available in `vegan`^[`r length(unique(vegan::make.commsim()))` as of `vegan` v`r as.character(packageVersion("vegan"))`, though not all may be applicable.], as well as an option to provide a user-defined algorithm. Selecting the appropriate algorithm is not trivial, and can greatly influence results^[For a good review of randomization algorithms and their implications for analysis results, see @Strona2018]. For details about the pre-defined algorithms, see `vegan::commsim()`.

This example also demonstrates one of the strengths of `canaper`: the ability to run randomizations in parallel^[For more information on how and when to use parallel computing in `canaper`, [see the "Parallel computing" vignette](https://joelnitta.github.io/canaper/articles/parallel.html)].
This example also demonstrates one of the strengths of `canaper`: the ability to run randomizations in parallel^[For more information on how and when to use parallel computing in `canaper`, [see the "Parallel computing" vignette](https://docs.ropensci.org/canaper/articles/parallel.html)].
This is by far the most time-consuming part of CANAPE, since we have to repeat the calculations many (e.g., hundreds or more) times across the randomized communities to obtain reliable results. Here, we set the number of iterations (`n_iterations`; i.e., the number of swaps used to produce each randomized community) fairly high because this community matrix is large and includes many zeros; thorough mixing by swapping many times is required to completely randomize the matrix.

We will use a low number of random communities (`n_reps`) so things finish relatively quickly; you should consider increasing `n_reps` for a "real" analysis^[For more information on setting the appropriate number of iterations and replicates, [see the "How many randomizations?" vignette](https://joelnitta.github.io/canaper/articles/how-many-rand.html).].
We will use a low number of random communities (`n_reps`) so things finish relatively quickly; you should consider increasing `n_reps` for a "real" analysis^[For more information on setting the appropriate number of iterations and replicates, [see the "How many randomizations?" vignette](https://docs.ropensci.org/canaper/articles/how-many-rand.html).].
We will use the `curveball` randomization algorithm, which maintains species richness and abundance patterns while randomizing species identity [@Strona2014]^[`curveball` is similar to `swap` but runs much faster so I chose it for this large dataset.].

```{r acacia-rand}
Expand Down
Loading

0 comments on commit 07bde1c

Please sign in to comment.