Skip to content

Commit

Permalink
Merge pull request #109 from StoXProject/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
edvinf authored Jan 12, 2024
2 parents 04a86ee + bea0271 commit 455f5ba
Show file tree
Hide file tree
Showing 32 changed files with 1,843 additions and 421 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/check-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
# for windows and mac all builds are pushed to drat repo on merge to master (except pre-release builds), except 'next'

# 2023-08-23 fails, not getting Reca. Because it is not built yet for macos and next or 4.3.
#- {os: macOS-latest, r: 'next', pkgext: '.tgz'}
#- {os: macOS-latest, r: '4.3', pkgext: '.tgz'}
- {os: macOS-latest, r: 'next', pkgext: '.tgz'} #tested without Reca
- {os: macOS-latest, r: '4.3', pkgext: '.tgz'} #tested without Reca
- {os: macOS-latest, r: '4.2', pkgext: '.tgz'}
- {os: macOS-latest, r: '4.1', pkgext: '.tgz'}
- {os: macOS-latest, r: '4.0', pkgext: '.tgz'}
Expand Down Expand Up @@ -181,15 +181,26 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- name: Check
# turn off testing of suggestions for configurations where Reca is not provided in StoX package repositories
- name: Check without suggest-dependencies
if: runner.os == 'macOS' && (matrix.config.r== 'next' || matrix.config.r== '4.3')
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_ : false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
shell: Rscript {0}

- name: Show testthat output
- name: Check with suggest-dependencies
if: runner.os != 'macOS' || (matrix.config.r!= 'next' && matrix.config.r!= '4.3')
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_ : true
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
shell: Rscript {0}

- name: Show unit test output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
run: find check -name 'tinytest.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload check results
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ on:
push:
branches:
- master
- testing
pull_request:
branches:
- testing
- develop

name: test-coverage
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: RstoxFDA
Version: 1.3.0-9002
Version: 1.3.0-9003
Date: 2023-12-07
Title: Fisheries Dependent Analysis with RstoX
Authors@R: c(
Expand Down
23 changes: 23 additions & 0 deletions R/CatchLotteryExample-datadoc.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#' Data from the Norwegian catch lottery sampling program.
#'
#' Example of data formatted as \code{\link[RstoxData]{StoxBioticData}}
#' Hauls are primary sampling units, selected by Poission sampling with selection probabilities proportional to the catch size.
#' The data contain North Sea herring samples from catch lottery sampling in 2022.
#'
#' @docType data
#'
#' @usage data(CatchLotteryExample)
#'
#' @format \code{\link[RstoxData]{StoxBioticData}}
#'
#' @keywords datasets
#' @concept Analytical estimation
#'
#' @examples
#' RstoxFDA::plotArea(RstoxFDA::CatchLotteryExample$Station,
#' areaDef=RstoxFDA::mainareaFdir2018,
#' latCol = "Latitude",
#' lonCol = "Longitude",
#' areaLabels = TRUE)
"CatchLotteryExample"

24 changes: 24 additions & 0 deletions R/CatchLotterySamplingExample-datadoc.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#' Sampling parameters from the Norwegian catch lottery sampling program.
#'
#' Example of data formatted as \code{\link[RstoxFDA]{PSUSamplingParametersData}}
#' Hauls are primary sampling units, selected by Poission sampling with selection probabilities proportional to the catch size.
#' The data contain sampling parameters for North Sea herring samples from catch lottery sampling in 2022.
#'
#' The corresponding samples are provided in \code{\link[RstoxFDA]{CatchLotteryExample}}
#'
#' @docType data
#'
#' @usage data(CatchLotterySamplingExample)
#'
#' @format \code{\link[RstoxData]{StoxBioticData}}
#'
#' @keywords datasets
#' @concept Analytical estimation
#'
#' @examples
#' #all selected PSU that where actuall sampled are provided in CatchLotteryExample
#' sum(!is.na(CatchLotterySamplingExample$SelectionTable$SamplingUnitId))
#' sum(CatchLotterySamplingExample$SelectionTable$SamplingUnitId %in%
#' CatchLotteryExample$Haul$HaulKey)
"CatchLotterySamplingExample"

1 change: 0 additions & 1 deletion R/RecaFormatChecks.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ checkWeightLength<-function(weightlength, landings){
checkCovariateConsistency <- function(modelobj, landingscov){
inlandings <- rownames(modelobj$info[modelobj$info[,"in.landings"]==1,])
if (any(!(inlandings %in% names(landingscov)))){
browser()
stop("some covariates labeled as in.landings are not found in corresponding covariate matrix in landings")
}

Expand Down
6 changes: 6 additions & 0 deletions R/RecaWrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -1108,3 +1108,9 @@ rEcaDataReport <- function(samples, landings, covariates){
out <- data.table::as.data.table(out)
return(out)
}

#' Runs Reca::eca.estimate. Provided so that tinytest unittest can be implemented in a way that is dependent on Reca being available
#' @noRd
eca.estimate <- function(AgeLength, WeightLength, Landings, GlobalParameters){
return(Reca::eca.estimate(AgeLength, WeightLength, Landings, GlobalParameters))
}
3 changes: 3 additions & 0 deletions R/StoxAnalyticalAnalysisFunctions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#' @noRd
PrepareHorvitzThompsonDomainEstimate <- function(){}

Loading

0 comments on commit 455f5ba

Please sign in to comment.