Skip to content

Commit

Permalink
Merge pull request #126 from TGuillerme/master
Browse files Browse the repository at this point in the history
v1.8 release
  • Loading branch information
TGuillerme authored Dec 11, 2023
2 parents 1528e21 + 938d993 commit b7bcf8a
Show file tree
Hide file tree
Showing 244 changed files with 20,290 additions and 3,501 deletions.
95 changes: 24 additions & 71 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
# 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:
- MCMCglmm
- main
- master
- release
branches: [main, master, release]
pull_request:
branches:
- MCMCglmm
- main
- master
- release
branches: [main, master, release]

name: R-CMD-check

Expand All @@ -26,73 +18,34 @@ jobs:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release', vignettes: ', "--ignore-vignettes"), build_args = ("--no-bulid-vignettes"'}
- {os: macOS-latest, r: 'release', vignettes: ', "--ignore-vignettes"), build_args = ("--no-bulid-vignettes"'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
RGL_USE_NULL: true
_R_CHECK_CRAN_INCOMING_: true # Seemingly not set by --as-cran
_R_CHECK_FORCE_SUGGESTS_: false # CRAN settings
R_COMPILE_AND_INSTALL_PACKAGES: 'never'
_R_CHECK_THINGS_IN_CHECK_DIR_: false
R_REMOTES_STANDALONE: true
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
_R_CHECK_CRAN_INCOMING_USE_ASPELL_: false # Set to true when can figure how to install aspell on Windows
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

R_KEEP_PKG_SOURCE: yes
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true

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 = c("soft", "Config/Needs/check")),
".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor),
".github/R-version")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get install ghostscript texlive-latex-base texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = c("soft", "Config/Needs/check"))
# pak::pkg_install("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran" ${{ matrix.config.vignettes }}),
error_on = "error", check_dir = "check")
shell: Rscript {0}
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
error-on: '"error"'
31 changes: 31 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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:
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@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::covr
needs: coverage

- name: Test coverage
run: covr::codecov(quiet = FALSE)
shell: Rscript {0}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ r_packages:


after_success:
- Rscript -e 'library(covr); codecov(token = "5f041826-63f1-47fa-b4a8-9a32633f47fa")'
- Rscript -e 'library(covr); codecov(token = "14042dcc-32e4-418a-b5ca-fa368414b775")'
20 changes: 12 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Package: dispRity
Title: Measuring Disparity
Author: Thomas Guillerme [aut, cre, cph],
Mark N Puttick [aut, cph]
Authors@R: c(person("Thomas", "Guillerme", role = c("aut", "cre", "cph"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-4325-1275")),
person("Mark", "Puttick", role = c("aut", "cph")),
person("Jack", "Hatfield", role = c("aut", "cph"))
)
Maintainer: Thomas Guillerme <[email protected]>
Version: 1.7.0
Date: 2022-08-08
Version: 1.8
Date: 2023-12-11
Description: A modular package for measuring disparity (multidimensional space occupancy). Disparity can be calculated from any matrix defining a multidimensional space. The package provides a set of implemented metrics to measure properties of the space and allows users to provide and test their own metrics. The package also provides functions for looking at disparity in a serial way (e.g. disparity through time) or per groups as well as visualising the results. Finally, this package provides several statistical tests for disparity analysis.
Depends:
R (>= 3.6.0),
Expand All @@ -16,6 +20,7 @@ Imports:
Claddis,
ellipse,
geometry,
GET,
graphics,
grDevices,
MASS,
Expand All @@ -24,17 +29,16 @@ Imports:
parallel,
phangorn,
phyclust,
phylolm,
utils,
vegan,
scales,
spptest,
zoo,
License: GPL-3 | file LICENSE
Remotes:
github::myllym/spptest@no_fastdepth
Suggests:
MCMCglmm,
geoscale,
testthat,
knitr
RoxygenNote: 7.2.0
RoxygenNote: 7.2.3
URL: https://github.com/TGuillerme/dispRity
24 changes: 16 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ importFrom("geometry", "convhulln", "dot")
importFrom("graphics", "abline", "axis", "boxplot", "hist", "image", "lines", "mtext", "par", "plot", "points", "polygon", "text", "layout", "legend", "barplot")
importFrom("grDevices", "colorRampPalette", "grey", "hcl", "heat.colors", "adjustcolor")
importFrom("MASS", "mvrnorm")
importFrom("methods", "hasArg", "formalArgs")#, "is")
importFrom("methods", "hasArg", "formalArgs", "is")
importFrom("mnormt", "dmnorm", "rmnorm")
# importFrom("paleotree", "timeSliceTree")
importFrom("phangorn", "dist.hamming", "NJ", "RF.dist", "CI", "RI", "optim.parsimony", "parsimony")
importFrom("phyclust", "gen.seq.HKY")
importFrom("phylolm", "phylolm")
importFrom("utils", "combn", "data", "capture.output", "tail")
importFrom("vegan", "adonis", "vegdist")
importFrom("vegan", "adonis2", "vegdist")
importFrom("scales", "rescale")
importFrom("spptest", "create_curve_set", "rank_envelope")
importFrom("GET", "create_curve_set", "rank_envelope")
importFrom("parallel", "parLapply", "detectCores", "makeCluster", "clusterExport", "stopCluster")
importFrom("zoo", "rollmean")
# importFrom("geomorph", "gpagen")
# importFrom("RCurl", "getURL", "url.exists")

Expand Down Expand Up @@ -61,7 +63,8 @@ export(dimension.level2.fun)
export(dimension.level3.fun)
export(disalignment)
export(displacements)
export(ellipse.volume)
export(ellipse.volume) # alias for ellipsoid.volume
export(ellipsoid.volume)
export(edge.length.tree)
export(func.div)
export(func.eve)
Expand All @@ -77,6 +80,7 @@ export(projections.tree)
export(quantiles)
export(radius)
export(ranges)
export(roundness)
export(span.tree.length)
export(variances)

Expand All @@ -88,6 +92,7 @@ export(model.test)
export(model.test.sim)
export(model.test.wrapper)
export(null.test)
export(pgls.dispRity)
export(randtest.dispRity)
# export(sequential.test)

Expand All @@ -103,7 +108,9 @@ export(get.subsets)
export(get.covar)
export(n.subsets)
export(make.dispRity)
export(rescale.dispRity)
export(name.subsets)
export(rescale.dispRity) # alias for scale
export(scale.dispRity)
export(size.subsets)
export(sort.dispRity)
export(add.tree)
Expand All @@ -120,9 +127,10 @@ export(MCMCglmm.traits)
export(MCMCglmm.levels)
export(MCMCglmm.sample)
export(MCMCglmm.covars)
export(MCMCglmm.variance)
export(pair.plot)
export(random.circle)
export(randtest.dist)
export(distance.randtest)
export(reduce.matrix)
export(reduce.space)
export(remove.zero.brlen)
Expand All @@ -140,8 +148,8 @@ export(get.contrast.matrix)
export(sim.morpho)
export(multi.ace)

##S3
S3method(adonis, dispRity)
##S3
S3method(scale, dispRity)
S3method(matrix, dispRity)
S3method(plot, char.diff)
S3method(plot, dispRity)
Expand Down
55 changes: 40 additions & 15 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,52 @@
<!--
dispRity 0.2.0 (2016-04-01)
dispRity v1.8 (2023-12-11) *dispRity.multi*
=========================

### NEW FEATURES

* Blabla
* Added the _dispRity.multi_ internal architecture now allowing users to work with different matrices **and** different trees as inputs for `custom.subsets`, `chrono.subsets`, `boot.matrix` and `dispRity`. This change is not affecting the user level appart from now allowing to bypass some error messages (thanks to Mario Corio for that obvious suggestion).
* *New utility function*: `name.subsets` for directly accessing the subsets names of a `dispRity` object (basically doing `names(my_dispRity$subsets)`).
* *New utility function*: `MCMCglmm.variance` for calculating the variance for specific terms in a `"MCMCglmm"` model.
* *New* statistical test: `pgls.dispRity` to run PGLS test on a `dispRity` object with a level-2 metric and a tree (using excellent [`phylolm`](https://CRAN.R-project.org/package=phylolm) algorithm). The new test comes with its own S3 print, summary and plot functions if the input `dispRity` data contains multiple trees or multiple matrices (running and handling the output of multiple `phylolm`).
* *New* options to `get.tree` utility function to get the trees in each subsets (thanks to Jack Hadfield for this suggestion and help with implementation).
* *New vignette* compiling resources for developers to help people (and future me) to edit the package.
* *New metric*: `roundness` to measure the roundness of a variance-covariance matrix.

### MINOR IMPROVEMENTS

* Blabla
* **CHANGE IN DEFAULT ARGUMENTS** for the `custom.subsets`, `chrono.subsets`, `boot.matrix` and `dispRity` functions: the `tree`, `FADLAD`, `prob` and `dimensions` arguments is now `NULL` by default (instead of missing).
* **CHANGE IN DEFAULT ARGUMENTS** for the `projections` function. The defaults are now `scale = TRUE`, `centre = FALSE` (previously `TRUE`) and `abs = FALSE` (previously `TRUE`). The default arguments for `dispRity.covar.projections` remain unchanged though (`scale = TRUE`, `centre = TRUE`, `abs = TRUE`).
* `randtest.dispRity` function's `subsets` argument now can take a list of arguments of subsets to compare is `data` is a `dispRity` object. The call message has also been updated to be much more verbose and clear of what has been tested.
* optimised internal logic for all the `projections.*` functions for speed.
* `test.metric` now also adds the slope coefficient if the option `model` is used.
* the default legends/row names when using `plot`/`summary` on `test.metric` results are now more easy to interpret.
* `reduce.space` has now 25 times less chances to be stuck on a local optimum.
* `match.tip.edges` now also works on nodes and on `"multiPhylo"` objects and has a added an option `use.parsimony` (default is `TRUE`) to propagate the matching down the tree (i.e. if two nodes have the same unique ancestor and variable value, the ancestor is consider to have that variable value as well).
* Improved margins handling in `covar.plot`.
* Updated test coverage here and there.
* `clean.data` can now also handle a list of `"phylo"` objects as `tree` input (i.e. it does not need to be specifically classed as `"multiPhylo"`).
* Changed dependencies to [`spptest`](https://github.com/myllym/spptest) to [`GET`](https://github.com/myllym/GET).
* `space.maker` can now generate specific row names and be replicated to generate a bunch of spaces (via the new optional arguments `elements.names` and `replicates` respectively).
* The `add.tree` utility function now has an optional argument to override any existing trees (`replace = TRUE`) or not (`replace = FALSE`; which remains the default previous behaviour).
* `print.dispRity` now recognises and highlights simulated data from the [`treats`](https://github.com/tguillerme/treats) package.
* Improved `NA` management for `S3` functions.
* Improved automatic centering and scaling for `covar.plot` making the figures more aesthetic.
* `remove.zero.brlen` now also removes negative branch lengths and works on `"multiPhylo"` objects (thanks to Thomas Johnson for this suggestion).
* `fill.dispRity` has now an extra argument `check` to toggle the data checking on and off (more for developers).
* `multi.ace` is now described in details in the manual.
* `slice.tree` has now a `keep.all.ancestors` option to do exactly that.

### BUG FIXES
* Blabla

* The correct types of changes are now plotted in legend when plotting the results of `test.metric`.
* `get.disparity` now correctly concatenates one dimensional results into a `"numeric"` (rather than a `"matrix"`).
* `make.metric` now internally handles `covar` object correctly (i.e. as distance matrices).
* Calculating disparity for multiple matrices and customised subsets now works as expected for all metric levels.

### DEPRECATED AND DEFUNCT

* Blabla
-->

<!-- * `dtt.dispRity` now works with any tree (including non-ultrametric ones and fossils only ones). -->
<!-- * `dtt.dispRity` now works with time-slicing. -->

* `ellipse.volume` has been changed to `ellipsoid.volume` to more accurately reflect what it is measuring.
* `rescale.dispRity` has been changed to `scale.dispRity` and correctly registered as a S3 method.
* `randtest.dist` has been changed to `distance.randtest` to avoid conflict with `*.dist` S3 methods.

dispRity v1.7 (2022-08-08) *MacMacGlimm*
=========================
Expand Down Expand Up @@ -73,7 +98,7 @@ dispRity v1.7 (2022-08-08) *MacMacGlimm*
* `standardGeneric` functions are now correctly interpreted as functions throughout the package.
* Fixed bug when plotting level 1 disparity metric results without bootstrapped (`observed = TRUE` is now used as the default).
* Fixed bug when plotting `test.metric` plots with `save.steps` options with more than two types of shifts.
* Fixed bug with `null.test` which is now correctly managing the number of dimensions inherited from `dispRity` objects (thanks to [Alex Slavenko](https://alexslavenko.weebly.com/) for spotting this one and the two above).
* Fixed bug with `null.test` which is now correctly managing the number of dimensions inherited from `dispRity` objects (thanks to Alex Slavenko for spotting this one and the two above).
* Fixed bug when using level 2 dimension metrics on unidimensional data (the metric is now detected as a level 2 correctly; thanks to Catherine Klein and [Rachel Warnock](https://www.gzn.nat.fau.de/palaeontologie/team/professors/rachel-warnock/) for noticing that one).
* Update internal use of `is(data, c("array", "matrix"))` to `is.array(data)` for R 4.1.2.

Expand All @@ -92,7 +117,7 @@ dispRity v1.6.0 (2021-04-16) *dispRitree*
* You can now save the shifts results in `test.metric` with `save.steps` and then visualise them with `plot.dispRity` along side the disparity metric test results.
* *New* utility function `n.subsets` to directly get the number of subsets in a `dispRity` object.
* *New* statistical test: `randtest.dispRity` that is a wrapper for `ade4::randtest` applied to `dispRity` objects (not dissimilar from `null.test`).
* Six more demo datasets have been added to the package! These datasets are the ones used in [Guillerme et al. 2020](https://scholar.google.co.uk/scholar?hl=en&as_sdt=0%2C5&q=Shifting+spaces%3A+Which+disparity+or+dissimilarity+measurement+best+summarize+occupancy+in+multidimensional+spaces%3F&btnG=) and published originally in [Beck & Lee 2014](https://royalsocietypublishing.org/doi/full/10.1098/rspb.2014.1278) (that one was originally the only demo dataset in the package), [Wright 2017](https://www.cambridge.org/core/journals/journal-of-paleontology/article/bayesian-estimation-of-fossil-phylogenies-and-the-evolution-of-early-to-middle-paleozoic-crinoids-echinodermata/E37972902541CD0995AAD08A1122BD54), [Marcy et al. 2016](https://link.springer.com/article/10.1186/s12862-016-0782-1), [Hopkins & Pearson 2016](https://pdfs.semanticscholar.org/a3f0/50944d2aefa1df811ea94a3eea630d82c24f.pdf)), [Jones et al. 2015](https://scholar.google.co.uk/scholar?hl=en&as_sdt=0%2C5&q=Dispersal+mode+mediates+the+effect+of+patch+size+and+patch+connectivity+on+metacommunity+diversity&btnG=), [Healy et al. 2019](https://www.nature.com/articles/s41559-019-0938-7). Thanks to all these authors for their open science work!
* Six more demo datasets have been added to the package! These datasets are the ones used in [Guillerme et al. 2020](https://scholar.google.co.uk/scholar?hl=en&as_sdt=0%2C5&q=Shifting+spaces%3A+Which+disparity+or+dissimilarity+measurement+best+summarize+occupancy+in+multidimensional+spaces%3F&btnG=) and published originally in [Beck & Lee 2014](https://doi.org/10.1098/rspb.2014.1278) (that one was originally the only demo dataset in the package), [Wright 2017](https://www.cambridge.org/core/journals/journal-of-paleontology/article/bayesian-estimation-of-fossil-phylogenies-and-the-evolution-of-early-to-middle-paleozoic-crinoids-echinodermata/E37972902541CD0995AAD08A1122BD54), [Marcy et al. 2016](https://link.springer.com/article/10.1186/s12862-016-0782-1), [Hopkins & Pearson 2016](https://pdfs.semanticscholar.org/a3f0/50944d2aefa1df811ea94a3eea630d82c24f.pdf)), [Jones et al. 2015](https://scholar.google.co.uk/scholar?hl=en&as_sdt=0%2C5&q=Dispersal+mode+mediates+the+effect+of+patch+size+and+patch+connectivity+on+metacommunity+diversity&btnG=), [Healy et al. 2019](https://www.nature.com/articles/s41559-019-0938-7). Thanks to all these authors for their open science work!
* `dispRity` objects now have a reserved `$tree` component that contain any number of trees attached to the data. This allows any function to use the reserved argument name `tree` to extract directly the relevant tree from the `dispRity` object, for functions like `chrono.subsets` or metrics like `ancestral.dist`! To help manipulate the `tree` component of the `dispRity` object, you can now use the new utility functions `add.tree`, `get.tree` and `remove.tree`.

### MINOR IMPROVEMENT
Expand Down Expand Up @@ -390,7 +415,7 @@ dispRity v0.3 (2017-01-25) *dispRity lite*

### NEW FEATURES

* Complete change of the `dispRity` object architecture (see more [here](https://github.com/TGuillerme/dispRity/blob/master/disparity_object.md)).
* Complete change of the `dispRity` object architecture.

### MINOR IMPROVEMENTS

Expand Down
Loading

0 comments on commit b7bcf8a

Please sign in to comment.