Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
130 changes: 85 additions & 45 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ on:
push:
branches:
- master
- develop
- testing
- develop
pull_request:
branches:
- master
- develop
- testing
- develop

name: R-CMD-check

Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
# ubuntu-latest is 24 as of 2024-10-31. Should we use it?
- {os: ubuntu-22.04, r: 'release', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-22.04, r: 'oldrel', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-22.04, r: 'oldrel-1', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
# - {os: ubuntu-22.04, r: 'oldrel-2', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"} # Skipping the oldrel-2, as we need equal requirements across platforms

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand All @@ -53,7 +53,7 @@ jobs:

- uses: actions/checkout@v4

- name: Do autorelease increment, tagging, and environment setup
- name: Prepare for deployment at push
if: github.event_name == 'push'
run: |
curl "https://raw.githubusercontent.com/StoXProject/unstableRepo/main/scripts/checktag-actions.sh" --output unstableRepo_checktag.sh
Expand Down Expand Up @@ -91,44 +91,19 @@ jobs:




#############################################################################
#### 2. R package installation (with system and R package dependencies): ####
#############################################################################

#- name: Query dependencies
# run: |
# install.packages('remotes')
# saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
# writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
# shell: Rscript {0}

#- name: Cache R packages
# if: runner.os != 'Windows'
# uses: actions/cache@v4
# 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-

# We don't use the code below using remotes::system_requirements anymore, since we do not have control over that function and should rather hard code the dependencies, which also lists the dependencies explicitely:
#- name: Install system dependencies
# if: runner.os == 'Linux'
# run: |
# while read -r cmd
# do
# eval sudo $cmd
# done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "22.04"))')

- name: Install MacOS system dependencies
## 2a. System dependencies:
- name: Install system dependencies on macOS
if: runner.os == 'macOS'
run: |
# gfortran may not exist in a period after a new R minor release:
gfortranFile='/usr/local/bin/gfortran'
if [ -f "$gfortranFile" ] ; then
rm "$gfortranFile"
fi
rm -f '/usr/local/bin/gfortran'
rm -f '/usr/local/bin/2to3'
rm -f '/usr/local/bin/2to3-3.11'
rm -f '/usr/local/bin/idle3'
Expand All @@ -139,7 +114,8 @@ jobs:
rm -f '/usr/local/bin/python3.11'
rm -f '/usr/local/bin/python3-config'
rm -f '/usr/local/bin/python3.11-config'
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=false # This prevents Homebrew from re-installing R, which will lead to .Platform$pkgType = "source".
rm -f '/usr/local/bin/gfortran'
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK= # This (the value should actually be empty...) prevents Homebrew from re-installing R, which will lead to .Platform$pkgType = "source".
brew install gdal
shell: bash

Expand All @@ -154,34 +130,100 @@ jobs:
shell: bash


## 2c. R packages needed for this yaml script (not related to the Rstox package itself):
## 2b. R packages needed for this yaml script (not related to the Rstox package itself):
- name: Install CRANdependencies
run: |
install.packages(c("rcmdcheck", "git2r", "sessioninfo", "knitr", "remotes", "drat"))
install.packages(c("rcmdcheck", "git2r", "sessioninfo", "knitr", "drat"))
shell: Rscript {0}


## 2d. Rstox packages and dependencies (the complicated if condition is needed since the reference to branch name is not consistent across event names). There is the issue that R sorts packge versions alphabetically, while StoX uses semantic versioning. Consequently a pre-release such as 1.2.3-9001 will be considered as newer than the official release 1.2.3 by R. We have solved this by separating the pre-releases and official releases into different repos "unstableRepo" and "testingRepo" for pre-releases and "repo" of official releases). This potentially breaks with remotes::install_deps() as it silently appends the Additional_repositories from the DESCRIPTION file to the repos, but since this would only be a problem if a pre-release is ranked as newer than the official release it will not be a problem when installing dependencies from the "repo" since the Additional_repositories points to that same repo:
## 2c. Rstox packages and dependencies (the complicated if condition is needed since the reference to branch name is not consistent across event names). There is the issue that R sorts packge versions alphabetically, while StoX uses semantic versioning. Consequently a pre-release such as 1.2.3-9001 will be considered as newer than the official release 1.2.3 by R. We have solved this by separating the pre-releases and official releases into different repos "unstableRepo" and "testingRepo" for pre-releases and "repo" of official releases). This potentially breaks with remotes::install_deps() as it silently appends the Additional_repositories from the DESCRIPTION file to the repos, but since this would only be a problem if a pre-release is ranked as newer than the official release it will not be a problem when installing dependencies from the "repo" since the Additional_repositories points to that same repo:
- name: Install R package dependencies from the unstableRepo
if: (github.event_name == 'push' && github.ref_name == 'develop') || (github.event_name == 'pull_request' && github.base_ref == 'develop')
run: |
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/unstableRepo/", "https://cloud.r-project.org/"))
# We hard code the list of top level dependencies, since the behavior of remotes::install_deps() that we used before is very unclear (e.g. how is the Additional_repositories included in the list of repos?):
topLevelDeps <- c(
# Imports:
"data.table",
"ggplot2",
"gridExtra",
"methods",
"RColorBrewer",
"rnaturalearth",
"rnaturalearthdata",
"RstoxData",
"RstoxBase",
"sf",
# Suggests:
"knitr",
"rmarkdown",
"tinytest"
)
install.packages(
topLevelDeps,
dependencies = TRUE,
repos = c("https://stoxproject.github.io/unstableRepo/", "https://cloud.r-project.org/")
)
shell: Rscript {0}

- name: Install R package dependencies from the testingRepo
if: (github.event_name == 'push' && github.ref_name == 'testing') || (github.event_name == 'pull_request' && github.base_ref == 'testing')
run: |
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/testingRepo/", "https://cloud.r-project.org/"))
# We hard code the list of top level dependencies, since the behavior of remotes::install_deps() that we used before is very unclear (e.g. how is the Additional_repositories included in the list of repos?):
topLevelDeps <- c(
# Imports:
"data.table",
"ggplot2",
"gridExtra",
"methods",
"RColorBrewer",
"rnaturalearth",
"rnaturalearthdata",
"RstoxData",
"RstoxBase",
"sf",
# Suggests:
"knitr",
"rmarkdown",
"tinytest"
)
install.packages(
topLevelDeps,
dependencies = TRUE,
repos = c("https://stoxproject.github.io/unstableRepo/", "https://cloud.r-project.org/")
)
shell: Rscript {0}

- name: Install R package dependencies from the official repo
if: (github.event_name == 'push' && github.ref_name == 'master') || (github.event_name == 'pull_request' && github.base_ref == 'master')
run: |
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/repo/", "https://cloud.r-project.org/"))
# We hard code the list of top level dependencies, since the behavior of remotes::install_deps() that we used before is very unclear (e.g. how is the Additional_repositories included in the list of repos?):
topLevelDeps <- c(
# Imports:
"data.table",
"ggplot2",
"gridExtra",
"methods",
"RColorBrewer",
"rnaturalearth",
"rnaturalearthdata",
"RstoxData",
"RstoxBase",
"sf",
# Suggests:
"knitr",
"rmarkdown",
"tinytest"
)
install.packages(
topLevelDeps,
dependencies = TRUE,
repos = c("https://stoxproject.github.io/unstableRepo/", "https://cloud.r-project.org/")
)
shell: Rscript {0}


## 2e. Session info:
## 2d. Session info:
- name: Session info
run: |
options(width = 100)
Expand Down Expand Up @@ -225,13 +267,12 @@ jobs:




#######################################################
#### 4. Build the package source and binary files: ####
#######################################################

- name: Build package source archive from branches develop, testing and master
if: runner.os == 'Linux' && matrix.config.r == '4.3' && github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'testing' || github.ref_name == 'develop')
- name: Build package source archive from branches develop, testing and master (on Linux for some reason)
if: runner.os == 'Linux' && matrix.config.r == 'release' && github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'testing' || github.ref_name == 'develop')
run: |
pkgbuild::build(".", dest_path = ".", binary = FALSE)
system(paste0("PKG_FREL=", Sys.getenv("PKG_FILE"), " >> ", Sys.getenv("GITHUB_ENV")))
Expand All @@ -250,7 +291,6 @@ jobs:




######################################
#### 5. Deploy to the drat repos: ####
######################################
Expand Down Expand Up @@ -291,7 +331,7 @@ jobs:
###############################

- name: Create release on GitHub and upload files for testing branch
if: ( (runner.os == 'Windows' && matrix.config.r != 'next') || (runner.os == 'macOS' && matrix.config.r != 'next') || (runner.os == 'Linux' && matrix.config.r == '4.3') ) && github.event_name == 'push' && github.ref_name == 'testing'
if: ( (runner.os == 'Windows') || (runner.os == 'macOS') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'testing'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
Expand All @@ -302,7 +342,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Create release on GitHub and upload files for master branch
if: ( (runner.os == 'Windows' && matrix.config.r != 'next') || (runner.os == 'macOS' && matrix.config.r != 'next') || (runner.os == 'Linux' && matrix.config.r == '4.3') ) && github.event_name == 'push' && github.ref_name == 'master'
if: ( (runner.os == 'Windows') || (runner.os == 'macOS') || (runner.os == 'Linux' && matrix.config.r == 'release') ) && github.event_name == 'push' && github.ref_name == 'master'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
Expand Down
17 changes: 7 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RstoxFDA
Version: 1.6.0
Date: 2025-03-18
Version: 1.7.0-9001
Date: 2025-09-01
Title: Fisheries Dependent Analysis with RstoX
Authors@R: c(
person(given = "Edvin",
Expand All @@ -10,14 +10,15 @@ Authors@R: c(
person(given = "Arne Johannes",
family = "Holmin",
role = "aut"))
Depends: R (>= 4.3)
Depends: R (>= 4.4)
Description: Fisheries dependent analysis, including running the Estimated Catch at Age
model through the Reca package developed by the Norwegian Computing Center.
URL: https://github.com/StoXProject/RstoxFDA
BugReports: https://github.com/StoXProject/RstoxFDA/issues
License: LGPL-3
LazyData: true
Encoding: UTF-8
VignetteBuilder: knitr
Imports:
data.table (>= 1.12.6),
ggplot2 (>= 3.2.1),
Expand All @@ -26,17 +27,13 @@ Imports:
RColorBrewer (>= 1.1-2),
rnaturalearth (>= 1.0.1),
rnaturalearthdata (>= 1.0.0),
RstoxBase (>= 2.1.1),
RstoxData (>= 2.1.1),
sf (>= 1.0.0),
stats (>= 3.5.0),
utils (>= 3.5.0)
RstoxBase (>= 2.2.0-9002),
RstoxData (>= 2.2.0-9002),
sf (>= 1.0.0)
Suggests:
knitr,
Reca,
rmarkdown,
tinytest
Additional_repositories:
https://stoxproject.github.io/repo
VignetteBuilder: knitr
RoxygenNote: 7.3.2
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# RstoxFDA v1.7.0-9001
* Temporary removing Reca as suggests due to failure to compile on macOS and Windows.
* Pre-generated help HTLM pages using the latest RstoxBuild.


# RstoxFDA v1.6
* Fixed issue with plotting with other column variables than 'Area' in PlotFisheriesOverviewSpatial (#147)
* Fixed ordering of age groups in ReportAnalyticalCatchAtAge (#134)
Expand Down
14 changes: 7 additions & 7 deletions R/StoxAnalysisFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ warnMissingLandings <- function(StoxBiotic, StoxLanding, effects){
#' \code{\link[RstoxFDA]{CarNeighbours}}, mandatory if 'carEffect' is given.
#' Identifies which values of the carEffect are to be considered as neighbours.
#' @param CellEffect
#' Configures the cell effect. Defaults to `r RstoxFDA:::stoxFunctionAttributes$PrepareRecaEstimate$functionParameterDefaults$CellEffect`. If 'All', an interaction term will be added with all covariates that in the cell (whether they are fixed or random effects).
#' Configures the cell effect. Defaults to `r RstoxFDA::stoxFunctionAttributes$PrepareRecaEstimate$functionParameterDefaults$CellEffect`. If 'All', an interaction term will be added with all covariates that in the cell (whether they are fixed or random effects).
#' Any CAR-effect is always included in the cell effect.
#' @param UseAgingError
#' If TRUE, aging, error parameters will be incorporated in the models.
Expand All @@ -240,7 +240,7 @@ warnMissingLandings <- function(StoxBiotic, StoxLanding, effects){
#' optional, resolution for length measurements in cm.
#' If not provided modal value from data is used.
#' @param HatchDay
#' defaults to Defaults to `r RstoxFDA:::stoxFunctionAttributes$PrepareRecaEstimate$functionParameterDefaults$HatchDay`.
#' defaults to Defaults to `r RstoxFDA::stoxFunctionAttributes$PrepareRecaEstimate$functionParameterDefaults$HatchDay`.
#' encoding the day of the year when fish is consider to transition from one age to the next. 1 represents Jan 1st.
#' @return \code{\link[RstoxFDA]{RecaData}} Data prepared for running Reca.
#' @seealso
Expand Down Expand Up @@ -564,10 +564,10 @@ RunRecaEstimate <- function(RecaData, Nsamples=integer(), Burnin=integer(), Thin
#' @param RecaData \code{\link[RstoxFDA]{RecaData}} as returned from \code{\link[RstoxFDA]{PrepareRecaEstimate}}
#' @param Nsamples number of MCMC samples that will be made available for \code{\link[Reca]{eca.predict}}. See documentation for \code{\link[Reca]{eca.estimate}},
#' @param Burnin number of MCMC samples run and discarded by \code{\link[Reca]{eca.estimate}} before any samples are saved. See documentation for \code{\link[Reca]{eca.estimate}}.
#' @param Lgamodel The length age relationship to use for length-age fits (options: "log-linear", "non-linear": Schnute-Richards model). See documentation for \code{\link[Reca]{eca.estimate}}. Defaults to `r RstoxFDA:::stoxFunctionAttributes$ParameterizeRecaModels$functionParameterDefaults$Lgamodel`
#' @param Lgamodel The length age relationship to use for length-age fits (options: "log-linear", "non-linear": Schnute-Richards model). See documentation for \code{\link[Reca]{eca.estimate}}. Defaults to `r RstoxFDA::stoxFunctionAttributes$ParameterizeRecaModels$functionParameterDefaults$Lgamodel`
#' @param ResultDirectory a directory where Reca may store temp-files \code{\link[Reca]{eca.estimate}} and \code{\link[Reca]{eca.predict}}. See details.
#' @param Thin controls how many iterations are run between each samples saved. Defaults to `r RstoxFDA:::stoxFunctionAttributes$ParameterizeRecaModels$functionParameterDefaults$Thin`. This may be set to account for autocorrelation introduced by Metropolis-Hastings simulation. see documentation for \code{\link[Reca]{eca.estimate}}
#' @param Delta.age see documentation for \code{\link[Reca]{eca.estimate}}. Defaults to `r RstoxFDA:::stoxFunctionAttributes$ParameterizeRecaModels$functionParameterDefaults$Delta.age`.
#' @param Thin controls how many iterations are run between each samples saved. Defaults to `r RstoxFDA::stoxFunctionAttributes$ParameterizeRecaModels$functionParameterDefaults$Thin`. This may be set to account for autocorrelation introduced by Metropolis-Hastings simulation. see documentation for \code{\link[Reca]{eca.estimate}}
#' @param Delta.age see documentation for \code{\link[Reca]{eca.estimate}}. Defaults to `r RstoxFDA::stoxFunctionAttributes$ParameterizeRecaModels$functionParameterDefaults$Delta.age`.
#' @param Seed see documentation for \code{\link[Reca]{eca.estimate}}. Defaults to random seed.
#' @param UseCachedData if TRUE Parameterization is not run, but any previous runs for exactly the same arguments are returned.
#' @return \code{\link[RstoxFDA]{RecaParameterData}} results from Reca Model Parameterization.
Expand Down Expand Up @@ -738,10 +738,10 @@ getLandingsFromStoxLandings <- function(RecaParameterData, StoxLandingData, Temp
#' @param StoxLandingData Landings data (\code{\link[RstoxData]{StoxLandingData}}).
#' @param GroupingVariables character vector identifying columns in 'StoxLandingData' that results should be provided for.
#' @param TemporalResolution
#' Code for temporal resolution in landings: "Month" or "Quarter". Defaults to `r RstoxFDA:::stoxFunctionAttributes$RunRecaModels$functionParameterDefaults$TemporalResolution`.
#' Code for temporal resolution in landings: "Month" or "Quarter". Defaults to `r RstoxFDA::stoxFunctionAttributes$RunRecaModels$functionParameterDefaults$TemporalResolution`.
#' Regulates temporal resolution for calculating fractional ages of fish.
#' Not to be confused with any temporal covariate.
#' @param Caa.burnin see documentation for \code{\link[Reca]{eca.predict}}. Defaults to `r RstoxFDA:::stoxFunctionAttributes$RunRecaModels$functionParameterDefaults$Caa.burnin`.
#' @param Caa.burnin see documentation for \code{\link[Reca]{eca.predict}}. Defaults to `r RstoxFDA::stoxFunctionAttributes$RunRecaModels$functionParameterDefaults$Caa.burnin`.
#' @param CollapseLength indicates whether length groups should be collapsed in result. Defaults to TRUE. See details.
#' @return \code{\link[RstoxFDA]{RecaCatchAtAge}}
#' @seealso \code{\link[RstoxFDA]{ParameterizeRecaModels}} for model parameterisation,
Expand Down
Loading
Loading