Skip to content

Commit

Permalink
small updates + add R_CMD_CHECK Action
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Thorson committed Nov 20, 2024
1 parent f722305 commit c8a84c2
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
^pkgdown$
^scratch$
^codecov\.yml$
^vignettes/web_only$
^vignettes/not_on_cran/.*$
^vignettes/too_slow/.*$
39 changes: 39 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install dependencies Ubuntu
if: runner.os == 'Linux'
run: |
install.packages('remotes')
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("knitr")
remotes::install_cran("rmarkdown")
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
10 changes: 0 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ Imports:
igraph
Suggests:
knitr
Enhances:
spict,
JABBA,
Rpath,
boot
Remotes:
DTUAqua/spict/spict,
jabbamodel/JABBA,
NOAA-EDAB/Rpath,
kaskr/RTMB/RTMBode
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
VignetteBuilder: knitr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ vignette: >
%\VignetteIndexEntry{Demonstrating EcoState via simulation}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
%\VignetteDepends{Rpath}
---

```{r, include = FALSE, warning=FALSE, message=FALSE}
Expand All @@ -15,6 +16,8 @@ knitr::opts_chunk$set(
comment = "#>"
)
start_time = Sys.time()
# Dependencies
# remotes::install_github( "NOAA-EDAB/Rpath" )
# Install locally
# devtools::install_local( R'(C:\Users\James.Thorson\Desktop\Git\ecostate)', force=TRUE )
# devtools::install_github( 'James-Thorson-NOAA/ecostate', force=TRUE )
Expand All @@ -25,6 +28,7 @@ start_time = Sys.time()

```{r setup, echo=TRUE, message=FALSE}
library(ecostate)
library(Rpath)
```

`ecostate` is an R package for fitting the mass-balance dynamics specified by EcoSim as a state-space model. We here highlight a few features in particular.
Expand Down Expand Up @@ -155,8 +159,6 @@ sim = simulate_data()
We then load `Rpath` and reformat inputs in the format that it expects to calculate mass-balance:

```{r, echo=TRUE, message=TRUE, fig.width=7, fig.height=7}
library(Rpath)
# Rpath needs types in ascending order (EcoState doesn't care)
types <- sapply( c(type_i,"fishery"), FUN=switch,
"hetero"==0, "auto"=1, "detritus"=2, "fishery"=3 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ vignette: >
%\VignetteIndexEntry{EcoState as surplus production model}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
%\VignetteDepends{spict,JABBA}
---

```{r, include = FALSE, warning=FALSE, message=FALSE}
Expand All @@ -15,6 +16,9 @@ knitr::opts_chunk$set(
comment = "#>"
)
start_time = Sys.time()
# Dependencies
# remotes::install_github( "jabbamodel/JABBA" )
# remotes::install_github( "DTUAqua/spict/spict" )
# Install locally
# devtools::install_local( R'(C:\Users\James.Thorson\Desktop\Git\ecostate)', force=TRUE, dep=FALSE )
# devtools::install_github( 'James-Thorson-NOAA/ecostate', force=TRUE )
Expand All @@ -25,6 +29,8 @@ start_time = Sys.time()

```{r setup, echo=TRUE, message=FALSE}
library(ecostate)
library(JABBA)
library(spict)
set.seed(101)
```

Expand Down Expand Up @@ -513,8 +519,6 @@ The model includes process-errors in the first-stage (eggs to recruits, from age
We can compare this with a state-space production model in continuous time (SPiCT):

```{r, echo=TRUE, message=TRUE, fig.width=7, fig.height=7}
library(spict)
# Format for SPiCT
datalist = list(
obsC = C_t[-1],
Expand All @@ -531,8 +535,6 @@ plotspict.biomass(res)
Similarly, we can compare it with Just Another Bayesian Biomass Assessment (JABBA):

```{r, echo=TRUE, message=TRUE, fig.width=7, fig.height=7}
library(JABBA)
# Compile JABBA JAGS model and input object
jbinput = build_jabba( catch = data.frame(Year=years, Total=C_t)[-1,],
cpue = data.frame(Year=years, Index=Bobs_t)[-1,],
Expand Down
File renamed without changes.

0 comments on commit c8a84c2

Please sign in to comment.