Skip to content

Commit

Permalink
Merge pull request #126 from iiasa/dev
Browse files Browse the repository at this point in the history
Dev to master for 0.1.3 version bump
  • Loading branch information
Martin-Jung authored May 10, 2024
2 parents 8ce95a2 + 2768eb8 commit ef889ee
Show file tree
Hide file tree
Showing 92 changed files with 3,889 additions and 819 deletions.
1 change: 1 addition & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
any::glmnetUtils,
any::pdp,
stan-dev/cmdstanr,
ElliotDovers/scampr,
any::igraph,
any::lwgeom,
any::ncmeta,
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
sudo apt-get -y install \
libudunits2-dev libgdal-dev libgeos-dev libproj-dev libglpk-dev
- name: Install inla
run: Rscript -e 'install.packages("INLA",repos=c(getOption("repos"),INLA="https://inla.r-inla-download.org/R/stable"),dep=TRUE)'

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
Expand Down
56 changes: 35 additions & 21 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -----------------------------------------------------------
# CITATION file created with {cffr} R package, v0.5.0
# CITATION file created with {cffr} R package, v1.0.0
# See also: https://docs.ropensci.org/cffr/
# -----------------------------------------------------------

Expand All @@ -8,7 +8,7 @@ message: 'To cite package "ibis.iSDM" in publications use:'
type: software
license: CC-BY-4.0
title: 'ibis.iSDM: Modelling framework for integrated biodiversity distribution scenarios'
version: 0.1.2
version: 0.1.3
abstract: Integrated framework of modelling the distribution of species and ecosystems
in a suitability framing. This package allows the estimation of integrated species
distribution models (iSDM) based on several sources of evidence and provided presence-only
Expand Down Expand Up @@ -196,29 +196,31 @@ references:
- family-names: Dunnington
given-names: Dewey
orcid: https://orcid.org/0000-0002-9415-4582
- family-names: Brand
given-names: Teun
name-particle: van den
orcid: https://orcid.org/0000-0002-9335-7468
year: '2024'
- type: software
title: graphics
abstract: 'R: A Language and Environment for Statistical Computing'
notes: Imports
authors:
- name: R Core Team
location:
name: Vienna, Austria
year: '2024'
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
- type: software
title: methods
abstract: 'R: A Language and Environment for Statistical Computing'
notes: Imports
authors:
- name: R Core Team
location:
name: Vienna, Austria
year: '2024'
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
- type: software
title: Matrix
abstract: 'Matrix: Sparse and Dense Matrix Classes and Methods'
Expand Down Expand Up @@ -255,11 +257,10 @@ references:
notes: Imports
authors:
- name: R Core Team
location:
name: Vienna, Austria
year: '2024'
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
- type: software
title: posterior
abstract: 'posterior: Tools for Working with Posterior Distributions'
Expand Down Expand Up @@ -312,11 +313,10 @@ references:
notes: Imports
authors:
- name: R Core Team
location:
name: Vienna, Austria
year: '2024'
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
- type: software
title: terra
abstract: 'terra: Spatial Data Analysis'
Expand Down Expand Up @@ -366,22 +366,20 @@ references:
notes: Imports
authors:
- name: R Core Team
location:
name: Vienna, Austria
year: '2024'
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
- type: software
title: 'R: A Language and Environment for Statistical Computing'
notes: Depends
url: https://www.R-project.org/
authors:
- name: R Core Team
location:
name: Vienna, Austria
year: '2024'
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2024'
version: '>= 4.1.0'
- type: software
title: abind
Expand Down Expand Up @@ -670,7 +668,7 @@ references:
title: ncmeta
abstract: 'ncmeta: Straightforward ''NetCDF'' Metadata'
notes: Suggests
url: https://github.com/hypertidy/ncmeta
url: https://hypertidy.github.io/ncmeta/
repository: https://CRAN.R-project.org/package=ncmeta
authors:
- family-names: Sumner
Expand Down Expand Up @@ -745,6 +743,22 @@ references:
email: [email protected]
orcid: https://orcid.org/0000-0003-3925-190X
year: '2024'
- type: software
title: lubridate
abstract: 'lubridate: Make Dealing with Dates a Little Easier'
notes: Suggests
url: https://lubridate.tidyverse.org
repository: https://CRAN.R-project.org/package=lubridate
authors:
- family-names: Spinu
given-names: Vitalie
email: [email protected]
- family-names: Grolemund
given-names: Garrett
- family-names: Wickham
given-names: Hadley
year: '2024'
version: '>= 1.9.0'
- type: software
title: rstan
abstract: 'rstan: R Interface to Stan'
Expand Down
7 changes: 6 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ibis.iSDM
Type: Package
Title: Modelling framework for integrated biodiversity distribution scenarios
Version: 0.1.2
Version: 0.1.3
Authors@R:
c(person(given = "Martin",
family = "Jung",
Expand Down Expand Up @@ -76,6 +76,7 @@ Suggests:
progress,
pdp,
rmarkdown,
lubridate (>= 1.9.0),
rstan (>= 2.21.0),
rstantools (>= 2.1.1),
testthat (>= 3.0.0),
Expand Down Expand Up @@ -123,6 +124,7 @@ Collate:
'utils-inla.R'
'engine_inla.R'
'engine_inlabru.R'
'engine_scampr.R'
'engine_stan.R'
'engine_xgboost.R'
'ensemble.R'
Expand All @@ -145,6 +147,7 @@ Collate:
'priors.R'
'project.R'
'pseudoabsence.R'
'render_html.R'
'scenario.R'
'similarity.R'
'simulate_population_steps.R'
Expand All @@ -165,3 +168,5 @@ Collate:
'validate.R'
'write_output.R'
'zzz.R'
Remotes:
ElliotDovers/scampr
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export(add_constraint_boundary)
export(add_constraint_connectivity)
export(add_constraint_dispersal)
export(add_constraint_minsize)
export(add_constraint_threshold)
export(add_control_bias)
export(add_control_extrapolation)
export(add_latent_spatial)
Expand All @@ -82,6 +83,7 @@ export(alignRasters)
export(as.Id)
export(bivplot)
export(check)
export(combine_formulas)
export(distribution)
export(emptyraster)
export(engine_bart)
Expand All @@ -91,6 +93,7 @@ export(engine_glm)
export(engine_glmnet)
export(engine_inla)
export(engine_inlabru)
export(engine_scampr)
export(engine_stan)
export(engine_xgboost)
export(ensemble)
Expand Down Expand Up @@ -129,6 +132,7 @@ export(predictor_transform)
export(priors)
export(project.BiodiversityScenario)
export(pseudoabs_settings)
export(render_html)
export(rm_biodiversity)
export(rm_latent)
export(rm_offset)
Expand Down
20 changes: 19 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# ibis.iSDM 0.1.2 (current dev branch)
# ibis.iSDM 0.1.3 (current dev branch)

#### New features
* Add functions that creates HTML file base on `DistributionModel`.
* Added new engine `engine_scampr()` for model-based integration.
* Allow projection of models using `method_integration = "predictor"`

#### Minor improvements and bug fixes
* Small fixes to ensure `boruta` filtering works (again)?
* Small fix to parameter in `train()` #102 @jeffreyhanson
* Small helper function for combining 2 different formula objects `combine_formulas()`
* Small bug fixes dealing with `scenario()` projections and limits, plus unit tests #104
* Bug fixes with adding `predictor_derivate()` to scenario predictors and added unit tests #106
* Several fixes related to different engines and priors.
* Changed default output for netcdf files to multidimensional arrays #109
* :fire: hot fixes for scenario scaling and normalization issue #113
* :bug: fix so that projection works with different extents than used for inference.

# ibis.iSDM 0.1.2

#### New features
* Switched object structure to `R6` throughout for improved data and memory handling #44
Expand Down
15 changes: 10 additions & 5 deletions R/add_biodiversity.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ NULL
#' @param formula A [`character`] or [`formula`] object to be passed. Default is
#' to use all covariates (if specified).
#' @param family A [`character`] stating the family to be used (Default: \code{'Poisson'}).
#' @param link A [`character`] to overwrite the default link function (Default: code{NULL}).
#' @param link A [`character`] to overwrite the default link function (Default: \code{NULL}).
#' @param weight A [`numeric`] value acting as a multiplier with regards to any
#' weights used in the modelling. Larger weights indicate higher weighting
#' relative to any other datasets. By default set to \code{1} if only one
Expand Down Expand Up @@ -130,7 +130,7 @@ methods::setMethod(

# Create a new biodiversity dataset
bd <- BiodiversityDataset$new(
name = ifelse(is.null(name), "Species: ",name),
name = ifelse(is.null(name), substring(id[[1]], 1, 8), name),
id = id,
equation = formula,
family = family,
Expand Down Expand Up @@ -232,6 +232,11 @@ methods::setMethod(
is.numeric(weight) && all(weight > 0),
is.logical(docheck)
)
# Raise a warning if there NA data
assertthat::assert_that(!anyNA(poipa[[field_occurrence]]) || !is.null(poipa[[field_occurrence]]),
msg = "NA observations or NULL occurrence field?")

# Check for that presence and absence are there.
assertthat::assert_that(length(unique(poipa[[field_occurrence]])) == 2,
msg = "Presence-Absence requires at exactly 2 unique values.")

Expand Down Expand Up @@ -268,7 +273,7 @@ methods::setMethod(

# Define the biodiversity object
bd <- BiodiversityDataset$new(
name = ifelse(is.null(name), "Species: ",name),
name = ifelse(is.null(name), substring(id[[1]], 1, 8), name),
id = id,
equation = formula,
family = family,
Expand Down Expand Up @@ -460,7 +465,7 @@ methods::setMethod(

# Define the biodiversity object
bd <- BiodiversityDataset$new(
name = ifelse(is.null(name), "Species: ",name),
name = ifelse(is.null(name), substring(id[[1]], 1, 8), name),
id = id,
equation = formula,
family = family,
Expand Down Expand Up @@ -681,7 +686,7 @@ methods::setMethod(

# Define the biodiversity object
bd <- BiodiversityDataset$new(
name = ifelse(is.null(name), "Species: ",name),
name = ifelse(is.null(name), substring(id[[1]], 1, 8), name),
id = id,
equation = formula,
family = family,
Expand Down
Loading

0 comments on commit ef889ee

Please sign in to comment.