From 4109e92c30f51ddda8412266ab9df82665631c2c Mon Sep 17 00:00:00 2001 From: Iago Mosqueira Date: Sun, 1 Dec 2024 19:41:30 +0100 Subject: [PATCH] Compiling again --- .github/.gitignore | 1 - .github/workflows/R-CMD-check.yaml | 81 ------------------------------ DESCRIPTION | 2 +- R/flxsa.R | 10 ++-- R/xsa.sa.R | 13 +++-- README.md | 4 +- man/xsa.sa.Rd | 7 ++- 7 files changed, 25 insertions(+), 93 deletions(-) delete mode 100644 .github/.gitignore delete mode 100644 .github/workflows/R-CMD-check.yaml diff --git a/.github/.gitignore b/.github/.gitignore deleted file mode 100644 index 2d19fc7..0000000 --- a/.github/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml deleted file mode 100644 index 5a54c2a..0000000 --- a/.github/workflows/R-CMD-check.yaml +++ /dev/null @@ -1,81 +0,0 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions -on: - push: - branches: - - master - pull_request: - branches: - - master - -name: R-CMD-check - -jobs: - R-CMD-check: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - - {os: windows-latest, r: 'devel', arch: x86_64, multiarch: '--no-multiarch'} - - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - - steps: - - uses: actions/checkout@v2 - - - uses: r-lib/actions/setup-r@v1 - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-pandoc@v1 - - - 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@v2 - 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- - - - 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", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check") - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check diff --git a/DESCRIPTION b/DESCRIPTION index bae92c6..7c528ea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -17,5 +17,5 @@ Depends: Suggests: testthat Additional_repositories: http://flr-project.org/R -RoxygenNote: 7.2.1 +RoxygenNote: 7.3.2 ByteCompile: TRUE diff --git a/R/flxsa.R b/R/flxsa.R index 1a67c12..1b40383 100644 --- a/R/flxsa.R +++ b/R/flxsa.R @@ -166,7 +166,7 @@ setMethod("FLXSA", signature(stock="FLStock", indices="FLIndex"), setMethod("FLXSA", signature(stock="FLStock", indices="FLIndices"), function(stock, indices, control=FLXSA.control(), diag.flag=TRUE) { - + Call <- match.call() # check FLIndices input for (i in 1:length(indices)) { @@ -299,10 +299,12 @@ setMethod("FLXSA", signature(stock="FLStock", indices="FLIndices"), res@range <- stock@range return(res) - } + } + + res <- .Call("runFLXSA", stock, indices, control, diag.flag) + + res <- fqs(res) - res <-fqs(.Call("runFLXSA", stock, indices, control, diag.flag)) - if (class(res) != "FLXSA") return(res) res@call <- as.character(Call) diff --git a/R/xsa.sa.R b/R/xsa.sa.R index d37ebbc..a511df1 100644 --- a/R/xsa.sa.R +++ b/R/xsa.sa.R @@ -17,12 +17,15 @@ #' of maximum number of iterations (maxit). #' @param stk An FLStock. #' @param idx An FLIndices. +#' @param args Arguments for call to mp(), list. +#' @param tracking Tracking FLQuant. #' #' @return A list containing the updated FLStock, and the tracking FLQuant. #' @examples #' data(ple4) #' data(ple4.index) -#' xsa.sa(stk=ple4, idx=ple4.index, args=list(ay=2018), tracking=FLQuant()) +#' xsa.sa(stk=ple4, idx=ple4.index, args=list(ay=2018), +#' tracking=FLQuant(dimnames=list(quant='conv.est', year=2018))) xsa.sa <- function(stk, idx, args, tracking, ...) { @@ -31,13 +34,17 @@ xsa.sa <- function(stk, idx, args, tracking, ...) { args0$stock <- stk args0$indices <- idx + # SET default control if missing if(is.null(args0$control)) args0$control <- FLXSA.control() + # CALL to fit fit <- do.call('FLXSA', args0) + # UPDATE stk stk <- stk + fit - track(tracking, "conv.est", ac(args$ay)) <- fit@control@maxit - + # TRACK 'convergence' + tracking['conv.est', ac(args$ay)] <- fit@control@maxit + list(stk = stk, tracking = tracking) } # }}} diff --git a/README.md b/README.md index 23d51e0..0b98002 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # FLXSA -- Version: 2.6.5.9002 -- Date: 03-05-2022 +- Version: 2.6.6 +- Date: 11-10-2022 - Author: Laurence T. Kell - Maintainer: FLR Team - Repository: diff --git a/man/xsa.sa.Rd b/man/xsa.sa.Rd index 8e10184..59549a3 100644 --- a/man/xsa.sa.Rd +++ b/man/xsa.sa.Rd @@ -10,6 +10,10 @@ xsa.sa(stk, idx, args, tracking, ...) \item{stk}{An FLStock.} \item{idx}{An FLIndices.} + +\item{args}{Arguments for call to mp(), list.} + +\item{tracking}{Tracking FLQuant.} } \value{ A list containing the updated FLStock, and the tracking FLQuant. @@ -24,5 +28,6 @@ of maximum number of iterations (maxit). \examples{ data(ple4) data(ple4.index) -xsa.sa(stk=ple4, idx=ple4.index, args=list(ay=2018), tracking=FLQuant()) +xsa.sa(stk=ple4, idx=ple4.index, args=list(ay=2018), + tracking=FLQuant(dimnames=list(quant='conv.est', year=2018))) }