Skip to content
Merged

Spde #29

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
23727c3
add an Spde class
ThierryO Sep 10, 2024
0937ab9
add spec2mesh()
ThierryO Sep 10, 2024
7cba059
add spec2matern()
ThierryO Sep 10, 2024
3c5d458
add the n2kSpde class
ThierryO Sep 10, 2024
705ee80
add make_a()
ThierryO Sep 10, 2024
63a6909
add a method for fit_model() on an n2kSpde
ThierryO Sep 10, 2024
eea9711
bump package version
ThierryO Sep 10, 2024
e03ab11
fix checklist issues
ThierryO Sep 11, 2024
0c5e455
update checklist infrastructure
ThierryO Sep 11, 2024
1630236
define missing suggested package
ThierryO Sep 11, 2024
85b8a58
require latest version of multimput
ThierryO Sep 12, 2024
365dce9
fix documentation issues
ThierryO Sep 12, 2024
9d52dcf
add url to pkgdown
ThierryO Sep 12, 2024
93af224
bugfix in fit_model() on n2kSpde
ThierryO Sep 19, 2024
d24c21c
add moving_trend()
ThierryO Sep 19, 2024
b48582b
add moving_trend()
ThierryO Sep 19, 2024
79854e9
add moving_difference()
ThierryO Sep 19, 2024
c8de1e6
fit fit_model() on n2kManifest
ThierryO Sep 22, 2024
1f27287
add pkgdown url to DESCRIPTION
ThierryO Oct 3, 2024
cf10019
fit_model() on hurdleImput stores intermediate models
ThierryO Oct 7, 2024
20afc67
manifest_yaml_to_bash() creates the project and yaml subfolders when …
ThierryO Oct 8, 2024
a48dd4a
fit_model() on n2kSpde with imputations returns an n2kSpde model
ThierryO Oct 8, 2024
124f8cd
export order_manifest()
ThierryO Oct 9, 2024
e65e559
add get_datafield_id()
ThierryO Oct 27, 2024
953668b
use base pipe in fit_model() on n2kComposite
ThierryO Oct 27, 2024
659a7bb
use pak::pkg_install() instead of remotes::install_github() in Docker…
ThierryO Oct 31, 2024
0b08e56
fit_model() on n2kManifest stores the status of processed analyses. S…
ThierryO Nov 1, 2024
40177fe
fit_model() on n2kManifest displays the progress
ThierryO Nov 6, 2024
10f0e7d
try to fit INLA model without control.family settings
ThierryO Nov 8, 2024
143b2c9
add extract() method for n2kModelImputed
ThierryO Nov 13, 2024
e255840
fit_model() on n2kHurdle handles the case when not all parent models …
ThierryO Nov 13, 2024
7180762
fit_model() on n2kManifest() does not use a default for the local arg…
ThierryO Nov 13, 2024
dc16f94
fit_model() on n2kManifest displays the system time
ThierryO Dec 5, 2024
628149f
fit_model) on n2kManifest displays the ETA
ThierryO Dec 7, 2024
237bf7a
📝 Fix spelling errors
ThierryO Jan 21, 2025
ae1c454
➕ Add missing dependency
ThierryO Jan 21, 2025
fffe9e5
📝 Update citation
ThierryO Jan 21, 2025
44ffa65
📝 Moving_difference() gains a default value for first_year
ThierryO Jan 21, 2025
c9e77cc
🚨 Fix alias for extract() on n2kModelImputed
ThierryO Jan 21, 2025
8c704ee
🚨 Reduce cyclomatic complexity of fit_model() on n2kInla()
ThierryO Jan 21, 2025
ec8eb7d
🧱 Add Rstudio project id
ThierryO Jan 21, 2025
c99b2c6
✅ Fix unit tests on fit_model()
ThierryO Jan 21, 2025
1681c67
➕ Import median() from stats
ThierryO Jan 21, 2025
a72993a
📝 Document arguments of order_manifest()
ThierryO Jan 21, 2025
00080d1
⬆️ Require git2rdata 0.5.0
ThierryO Jan 24, 2025
efaa036
✅ Add unit test for n2k_spde()
ThierryO Jan 26, 2025
9ee63d5
✅ Add unit test for get_datafield_id()
ThierryO Jan 27, 2025
7e9a159
💚 Pass missing environment variables to GHA
ThierryO Jan 29, 2025
7bbf7ef
✅ Add unit tests for get_result() on n2kManifest
ThierryO Jan 30, 2025
f301638
♻️ Improve manifest_yaml_to_bash()
ThierryO Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
^data-raw$
^docs$
^man-roxygen$
^organisation.yml$
^pkgdown$
^wercker\.yml$
5 changes: 2 additions & 3 deletions .github/workflows/check_on_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ on:
push:
branches-ignore:
- main
- master
- ghpages

name: "check package with checklist"
Expand All @@ -14,11 +13,11 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
N2KBUCKET: ${{ secrets.N2KBUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
N2KBUCKET: ${{ secrets.N2KBUCKET }}
permissions:
contents: read
steps:
- uses: inbo/actions/check_pkg@checklist-0.3.6
- uses: inbo/actions/check_pkg@checklist-0.4.1
3 changes: 2 additions & 1 deletion .github/workflows/check_on_different_r_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-22.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}
- {os: ubuntu-22.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"}

Expand All @@ -40,7 +41,7 @@ jobs:
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
extra-repositories: https://inla.r-inla-download.org/R/testing
extra-repositories: https://inla.r-inla-download.org/R/stable

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check_on_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
N2KBUCKET: ${{ secrets.N2KBUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
N2KBUCKET: ${{ secrets.N2KBUCKET }}
steps:
- uses: inbo/actions/check_pkg@checklist-0.3.6
- uses: inbo/actions/check_pkg@checklist-0.4.1
27 changes: 8 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,21 @@ on:
- completed

jobs:
prepare:
publish:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.gettag.outputs.tag }}
body: ${{ steps.gettag.outputs.body }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Get tag
run: |
git fetch --tags --force
TAG=$(git tag --contains $(git rev-parse HEAD))
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
TAG_BODY=$(git tag --contains $(git rev-parse HEAD) --format='%(contents)')
TAG_BODY="${TAG_BODY//'%'/'%25'}"
TAG_BODY="${TAG_BODY//$'\n'/'%0A'}"
TAG_BODY="${TAG_BODY//$'\r'/'%0D'}"
echo "body=$TAG_BODY" >> "$GITHUB_OUTPUT"
id: gettag
publish:
runs-on: ubuntu-latest
permissions:
contents: write
needs: prepare
steps:
echo "tag=$TAG" >> $GITHUB_ENV
echo "$TAG_BODY" > body.md
- uses: ncipollo/release-action@v1
with:
name: Release ${{needs.prepare.outputs.tag}}
tag: ${{needs.prepare.outputs.tag}}
body: ${{needs.prepare.outputs.body}}
name: Release ${{ env.tag }}
tag: ${{ env.tag }}
bodyFile: body.md
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
.Ruserdata
.httr-oauth
docs
inst/doc
libs
output
renv/library
inst/doc
8 changes: 4 additions & 4 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"title": "n2kanalysis: Generic Functions to Analyse Data from the 'Natura 2000' Monitoring",
"version": "0.3.2",
"version": "0.4.0",
"license": "GPL-3.0",
"upload_type": "software",
"description": "<p>All generic functions and classes for the analysis for the ‘Natura\n2000’ monitoring. The classes contain all required data and definitions\nto fit the model without the need to access other sources. Potentially\nthey might need access to one or more parent objects. An aggregation\nobject might for example need the result of an imputation object. The\nactual definition of the analysis, using these generic function and\nclasses, is defined in dedictated analysis R packages for every\nmonitoring scheme. For example ‘abvanalysis’ and\n‘watervogelanalysis’.<\/p>",
"description": "<p>All generic functions and classes for the analysis for the ‘Natura 2000’ monitoring. The classes contain all required data and definitions to fit the model without the need to access other sources. Potentially they might need access to one or more parent objects. An aggregation object might for example need the result of an imputation object. The actual definition of the analysis, using these generic function and classes, is defined in dedictated analysis R packages for every monitoring scheme. For example ‘abvanalysis’ and ‘watervogelanalysis’.<\/p>",
"keywords": [
"analysis, reproducible research, natura 2000, monitoring"
],
Expand All @@ -14,11 +14,11 @@
"name": "Onkelinx, Thierry",
"affiliation": "Research Institute for Nature and Forest (INBO)",
"orcid": "0000-0001-8804-4216",
"type": "ContactPerson"
"type": "contactperson"
},
{
"name": "Research Institute for Nature and Forest (INBO)",
"type": "RightsHolder"
"type": "rightsholder"
}
],
"creators": [
Expand Down
4 changes: 3 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ abstract: "All generic functions and classes for the analysis for the 'Natura 20
identifiers:
- type: doi
value: 10.5281/zenodo.3576047
version: 0.3.2
- type: url
value: https://inbo.github.io/n2kanalysis/
version: 0.4.0
31 changes: 24 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: n2kanalysis
Title: Generic Functions to Analyse Data from the 'Natura 2000' Monitoring
Version: 0.3.2
Version: 0.4.0
Authors@R: c(
person("Thierry", "Onkelinx", , "thierry.onkelinx@inbo.be", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8804-4216", affiliation = "Research Institute for Nature and Forest (INBO)")),
Expand All @@ -16,7 +16,8 @@ Description: All generic functions and classes for the analysis for the
every monitoring scheme. For example 'abvanalysis' and
'watervogelanalysis'.
License: GPL-3
URL: https://doi.org/10.5281/zenodo.3576047
URL: https://doi.org/10.5281/zenodo.3576047,
https://inbo.github.io/n2kanalysis/
BugReports: https://github.com/inbo/n2kanalysis/issues
Depends:
R (>= 4.2.0)
Expand All @@ -26,22 +27,26 @@ Imports:
digest (>= 0.6.23.2),
dplyr,
fs,
git2rdata (>= 0.5.0),
MASS,
methods,
multimput (>= 0.2.13),
multimput (>= 0.2.14),
n2khelper (>= 0.5.0),
purrr,
rlang,
RODBC,
tibble,
tidyr (>= 0.4.0),
tools,
yaml
Suggests:
fmesher,
INLA (>= 23.04.24),
knitr,
Matrix,
parallel,
rmarkdown,
sf,
sn,
testthat (>= 2.0.1)
VignetteBuilder:
Expand All @@ -57,7 +62,7 @@ Config/checklist/keywords: analysis, reproducible research, natura 2000,
Encoding: UTF-8
Language: en-GB
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Collate:
'n2k_parameter_class.R'
'n2k_anomaly_class.R'
Expand All @@ -71,31 +76,35 @@ Collate:
'delete_model.R'
'display.R'
'n2k_model_class.R'
'n2k_inla_comparison_class.R'
'n2k_inla_class.R'
'n2k_aggregate_class.R'
'n2k_model_imputed_class.R'
'extract.R'
'fit_every_model.R'
'fit_model.R'
'fit_model_character.R'
'n2k_aggregate_class.R'
'fit_model_n2k_aggregate.R'
'n2k_composite_class.R'
'fit_model_n2k_composite.R'
'n2k_hurdle_imputed_class.R'
'fit_model_n2k_hurdle_imputed.R'
'fit_model_n2k_inla.R'
'n2k_inla_comparison_class.R'
'fit_model_n2k_inla_comparison.R'
'n2k_manifest_class.R'
'fit_model_n2k_manifest.R'
'n2k_model_imputed_class.R'
'fit_model_n2k_model_imputed.R'
'spde_class.R'
'n2k_spde_class.R'
'fit_model_n2k_spde.R'
'fit_model_s3_object.R'
'get_analysis_date.R'
'get_analysis_version.R'
'get_anomaly.R'
'get_anomaly_n2k_inla.R'
'get_anomaly_n2k_model.R'
'get_data.R'
'get_datafield_id.R'
'get_file_fingerprint.R'
'get_formula.R'
'get_location_group_id.R'
Expand All @@ -120,8 +129,12 @@ Collate:
'get_species_group_id.R'
'get_status_fingerprint.R'
'inla_inverse.R'
'make_a.R'
'manifest_yaml_to_bash.R'
'mark_obsolete_dataset.R'
'moving_average.R'
'moving_difference.R'
'moving_trend.R'
'n2k_aggregated.R'
'n2k_composite.R'
'n2k_hurdle_imputed.R'
Expand All @@ -131,6 +144,7 @@ Collate:
'n2k_inla_comparison.R'
'n2k_manifest.R'
'n2k_model_imputed.R'
'n2k_spde.R'
'parent_status.R'
'read_manifest.R'
'read_model.R'
Expand All @@ -146,6 +160,9 @@ Collate:
'select_observed_range.R'
'session_package.R'
'sha1.R'
'spde.R'
'spde2matern.R'
'spde2mesh.R'
'status.R'
'store_manifest.R'
'store_manifest_yaml.R'
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### GNU GENERAL PUBLIC LICENSE
# GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Expand Down
18 changes: 18 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ S3method(sha1,inla)
S3method(sha1,rawImputed)
export(display)
export(fit_every_model)
export(get_datafield_id)
export(get_parents)
export(inla_inverse)
export(mark_obsolete_dataset)
export(moving_average)
export(moving_difference)
export(moving_trend)
export(order_manifest)
export(select_factor_count_strictly_positive)
export(select_factor_threshold)
export(select_observed_range)
export(sha1)
export(spde)
export(union)
exportClasses(Spde)
exportClasses(n2kAggregate)
exportClasses(n2kAnalysisMetadata)
exportClasses(n2kAnalysisVersion)
Expand All @@ -28,6 +35,7 @@ exportClasses(n2kModel)
exportClasses(n2kModelImputed)
exportClasses(n2kParameter)
exportClasses(n2kResult)
exportClasses(n2kSpde)
exportMethods("parent_status<-")
exportMethods("status<-")
exportMethods(combine)
Expand All @@ -49,6 +57,7 @@ exportMethods(get_scheme_id)
exportMethods(get_seed)
exportMethods(get_species_group_id)
exportMethods(get_status_fingerprint)
exportMethods(make_a)
exportMethods(manifest_yaml_to_bash)
exportMethods(n2k_aggregate)
exportMethods(n2k_composite)
Expand All @@ -58,13 +67,16 @@ exportMethods(n2k_inla)
exportMethods(n2k_inla_comparison)
exportMethods(n2k_manifest)
exportMethods(n2k_model_imputed)
exportMethods(n2k_spde)
exportMethods(parent_status)
exportMethods(read_manifest)
exportMethods(read_model)
exportMethods(read_result)
exportMethods(result_estimate)
exportMethods(result_metadata)
exportMethods(session_package)
exportMethods(spde2matern)
exportMethods(spde2mesh)
exportMethods(status)
exportMethods(store_manifest)
exportMethods(store_manifest_yaml)
Expand Down Expand Up @@ -131,6 +143,10 @@ importFrom(fs,file_delete)
importFrom(fs,file_exists)
importFrom(fs,path)
importFrom(fs,path_abs)
importFrom(git2rdata,is_git2rmeta)
importFrom(git2rdata,update_metadata)
importFrom(git2rdata,verify_vc)
importFrom(git2rdata,write_vc)
importFrom(methods,new)
importFrom(methods,setClass)
importFrom(methods,setClassUnion)
Expand Down Expand Up @@ -160,6 +176,7 @@ importFrom(rlang,"!!")
importFrom(rlang,.data)
importFrom(stats,as.formula)
importFrom(stats,coef)
importFrom(stats,median)
importFrom(stats,na.fail)
importFrom(stats,na.omit)
importFrom(stats,qnorm)
Expand All @@ -169,6 +186,7 @@ importFrom(stats,terms)
importFrom(tibble,rownames_to_column)
importFrom(tibble,tibble)
importFrom(tidyr,pivot_longer)
importFrom(tools,R_user_dir)
importFrom(utils,file_test)
importFrom(utils,flush.console)
importFrom(utils,head)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# `n2kanalysis` 0.4.0

* Handle INLA models with an SPDE element.

# `n2kanalysis` 0.3.2

* Make `fit_model()` more efficient.
Expand Down
14 changes: 14 additions & 0 deletions R/extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@
extractor(object@Model)
}
)


#' @rdname extract
#' @aliases extract,n2kModelImputed-methods
#' @importFrom methods setMethod new
#' @include n2k_model_imputed_class.R
setMethod(
f = "extract",
signature = signature(object = "n2kModelImputed"),
definition = function(extractor, object, base = NULL, project = NULL) {
assert_that(inherits(extractor, "function"))
extractor(object)

Check warning on line 77 in R/extract.R

View check run for this annotation

Codecov / codecov/patch

R/extract.R#L76-L77

Added lines #L76 - L77 were not covered by tests
}
)
Loading
Loading