Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #109

Merged
merged 29 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9b0af51
Skeleton for analytical estimator functions
Oct 14, 2023
585d167
fixed building dependency evaluate for macOS 4.2
Oct 15, 2023
13e10b9
fixed building dependency evaluate for macOS 4.2
Oct 15, 2023
3a861f7
Added example data for catch lottery parameters
Oct 16, 2023
6a831d2
Initial Stox function for defining design parameters.
Oct 17, 2023
01219a7
Revised format for design parameters. Implemented DefinitionMethod th…
Oct 17, 2023
ee8aa62
Removed presumable redundant brew update
Oct 17, 2023
d4fb219
renamed data type
Oct 31, 2023
c20ecba
Implemented IndividualDesignParameters
Nov 1, 2023
7fc7647
Added collapsing strata to IndividualSamplingParameters
Nov 1, 2023
1b0fc25
Redefined sampling weights. Added support for strata collapse
Nov 6, 2023
63b1461
Implemented AssignPSUSamplingParameters and added an example data set.
Nov 7, 2023
aa95c43
Added function for calculating co-inclusion probabilities
Nov 22, 2023
d780c9b
Refactored and redesigned a bit. Changed populaiton estimation strate…
Dec 6, 2023
c1ee8f1
Merge branch 'ecaMeanPlotBug' into catchlottery
Dec 7, 2023
76564a8
Merge branch 'develop' into catchlottery
Jan 11, 2024
be425c2
Added test coverage reporting for pull request for testing branch
Jan 11, 2024
69b8402
Added relaxed testing for platforms where Reca is not available
Jan 11, 2024
6d53435
Fixed workflow file
Jan 11, 2024
574d3ce
changed Reca dependent tests to run only when reca is installed.
Jan 11, 2024
a48c68e
Fixed suggests dependent tests
Jan 11, 2024
bf4e386
Fixed suggests dependent tests
Jan 11, 2024
cd7b544
Merge branch 'stox4adaptations' of https://github.com/StoXProject/Rst…
Jan 11, 2024
a1354b8
Fixed issue with unqualified function call in test
Jan 11, 2024
88aac85
Fixed display of error log
Jan 11, 2024
9392c6c
Hid some functions from namespace. Anticipating possible release for …
Jan 11, 2024
c1133dd
Cleaned up some notes
Jan 11, 2024
f89bbf8
Merge pull request #108 from StoXProject/stox4adaptations
edvinf Jan 11, 2024
bea0271
merged with testing
Jan 11, 2024
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
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
Loading