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

Issue 84 crancheck #88

Merged
merged 5 commits into from
Jul 26, 2024
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
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Description: Enable users to evaluate long-term trends using a Generalized
questions. Methodology described in Murphy (2019)
<doi:10.1016/j.envsoft.2019.03.027>.
Author: Rebecca Murphy, Elgin Perry, Jennifer Keisman, Jon Harcum, Erik W Leppo
Version: 2.0.11
Version: 2.0.11.9002
Maintainer: Erik W Leppo <Erik.Leppo@tetratech.com>
Depends:
R (>= 3.5.0)
License: GPL-3
LazyData: TRUE
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Encoding: UTF-8
Imports:
dataRetrieval,
Expand Down
17 changes: 16 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ NEWS

<!-- NEWS.md is generated from NEWS.Rmd. Please edit that file -->

#> Last Update: 2024-02-12 12:03:12.250764
#> Last Update: 2024-07-25 13:50:16.146636

# baytrends 2.0.11.9003

- release 2024-07-26
- docs: Add rhubv2 for testing befor posting to CRAN

# baytrends 2.0.11.9002

- refactor: Function impute to pass a dataframe with two columns named
left and right to fitdistrplus::fitdistcens

# baytrends 2.0.11.9001

- refactor: Function gamTestSeason to address logic error with
gamPenaltyCrit

# baytrends 2.0.11

Expand Down
15 changes: 15 additions & 0 deletions NEWS.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ knitr::opts_chunk$set(
cat(paste0("Last Update: ",Sys.time()))
```

# baytrends 2.0.11.9003

- release 2024-07-26
- docs: Add rhubv2 for testing befor posting to CRAN


# baytrends 2.0.11.9002

- refactor: Function impute to pass a dataframe with two columns named left
and right to fitdistrplus::fitdistcens

# baytrends 2.0.11.9001

- refactor: Function gamTestSeason to address logic error with gamPenaltyCrit

# baytrends 2.0.11

- Release 2024-02-12
Expand Down
14 changes: 7 additions & 7 deletions R/gamTestSeason.r
Original file line number Diff line number Diff line change
Expand Up @@ -615,17 +615,17 @@ gamTestSeason <-function(df, dep, stat, layer=NA, analySpec, gamTable=TRUE, gamP

# evaluate F-stat in ANOVA table #04Feb2017
FstatFlag <- ""
if(selectSetting==FALSE &&
(min(gamANOVAtbl$df, na.rm=TRUE) < gamPenaltyCrit[1] || #18Jul2018
if(selectSetting==FALSE &
(min(gamANOVAtbl$df, na.rm=TRUE) < gamPenaltyCrit[1] | #18Jul2018
max(gamANOVAtbl$F, na.rm=TRUE) > gamPenaltyCrit[2])) { #18Jul2018
gamANOVAtbl$Note <- '-'
if (length(gamANOVAtbl$df < gamPenaltyCrit[1] || #18Jul2018
if (length(gamANOVAtbl$df < gamPenaltyCrit[1] | #18Jul2018
gamANOVAtbl$F > gamPenaltyCrit[2]) == 1 & #18Jul2018
is.na(gamANOVAtbl$df < gamPenaltyCrit[1] || #18Jul2018
is.na(gamANOVAtbl$df < gamPenaltyCrit[1] | #18Jul2018
gamANOVAtbl$F > gamPenaltyCrit[2])[1]) { #18Jul2018
FstatFlag <- "" #18Jul2018
} else {
gamANOVAtbl[gamANOVAtbl$df < gamPenaltyCrit[1] ||
gamANOVAtbl[gamANOVAtbl$df < gamPenaltyCrit[1] |
gamANOVAtbl$F > gamPenaltyCrit[2],"Note"] <- "F-stat maybe unreliable"
FstatFlag <- "***"
}
Expand All @@ -634,8 +634,8 @@ gamTestSeason <-function(df, dep, stat, layer=NA, analySpec, gamTable=TRUE, gamP
# Output GAM ANOVA table #04Feb2017
if(gamTable) {

if(selectSetting==FALSE &&
(min(gamANOVAtbl$df, na.rm=TRUE) < gamPenaltyCrit[1] || #18Jul2018
if(selectSetting==FALSE &
(min(gamANOVAtbl$df, na.rm=TRUE) < gamPenaltyCrit[1] | #18Jul2018
max(gamANOVAtbl$F, na.rm=TRUE) > gamPenaltyCrit[2])) { #18Jul2018
.T("GAM Analysis of Variance.")
print(knitr::kable(gamANOVAtbl[,],
Expand Down
10 changes: 5 additions & 5 deletions R/imputeCensored.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impute <-function(x, imputeOption="mid") {

# Error traps ####

# Error trap ... make sure x variable is a qw class
# Error trap ... make sure x variable is a Surv class
if (!(class(x) %in% c("Surv"))) {
stop("input vector not of type Surv.")
}
Expand Down Expand Up @@ -111,17 +111,17 @@ impute <-function(x, imputeOption="mid") {
} else if (imputeOption == "uniform") {
x3[not.miss] <- stats::runif(sum(not.miss), x[not.miss,1], x[not.miss,2])
} else if (imputeOption == "norm") {
myData1 <- data.frame(x=x2[not.miss], left=x[not.miss,1]
, right=x[not.miss,2])
fn1 <- fitdistrplus::fitdistcens(myData1, distr="norm")
myData1 <- data.frame(x=x2[not.miss], left=x[not.miss,1]
, right=x[not.miss,2])
fn1 <- fitdistrplus::fitdistcens(myData1[,c("left", "right")], distr="norm")
mu.norm <- fn1$estimate[1]
sd.norm <- fn1$estimate[2]
myData1$normExpec <- .ExpNmCens(myData1,dep="x",mu.norm,sd.norm)[,1]
x3[not.miss] <- myData1$normExpec
} else if (imputeOption == "lnorm") {
myData1 <- data.frame(x=x2[not.miss], left=x[not.miss,1]
, right=x[not.miss,2])
fn1 <- fitdistrplus::fitdistcens(myData1, distr="lnorm")
fn1 <- fitdistrplus::fitdistcens(myData1[,c("left", "right")], distr="lnorm")
mu.lnorm <- fn1$estimate[1]
sd.lnorm <- fn1$estimate[2]
myData1$lnormExpec <- .ExpLNmCens(myData1,dep="x",mu.lnorm,sd.lnorm)[,1]
Expand Down
18 changes: 13 additions & 5 deletions inst/extdata/baytrends_LibraryCreation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@ file.remove("NEWS.html")
#setwd(paste0("./", myLibrary))
devtools::document()
## Install New Package (locally)
setwd("..") # return to root directory first
devtools::install(myLibrary, quick=FALSE, reload=TRUE, build_vignettes = TRUE)
#setwd("..") # return to root directory first
devtools::install(".", quick=FALSE, reload=TRUE, build_vignettes = TRUE)

# blank line above ensures no "updates" to packages.
# ## Reload library
# library(myLibrary, character.only = TRUE)
# change wd back to package
setwd(file.path(".", myLibrary))
#setwd(file.path(".", myLibrary))
help(package=(myLibrary))
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Expand Down Expand Up @@ -158,6 +159,11 @@ Downstream dependancies
devtools::revdep("baytrends")
```

URL check
```{r URL_Check}
urlchecker::url_check()
```


## Check

Expand All @@ -174,9 +180,11 @@ Check failures
but puts it all in one place. Have to run *after* using Check.
```{r CheckFailures, eval=FALSE}
library(devtools)
dir.check <- "C:\\Users\\Erik.Leppo\\OneDrive - Tetra Tech, Inc\\MyDocs_OneDrive\\GitHub\\baytrends.Rcheck"
# dir.check <- "C:\\Users\\Erik.Leppo\\OneDrive - Tetra Tech, Inc\\MyDocs_OneDrive\\GitHub\\baytrends.Rcheck"
dir.check <- file.path(dirname(getwd()), "baytrends.Rcheck")
#
check_failures(dir.check)
# 20240726, no longer a function


```
Expand All @@ -199,7 +207,7 @@ check_for_cran() # win and linux
check_on_linux()

```

20240726, above no longer works since v2


Run all Examples.
Expand Down
48 changes: 27 additions & 21 deletions inst/extdata/baytrends_LibraryCreation.nb.html

Large diffs are not rendered by default.

Loading