-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from nmfs-fish-tools/main
Merge recent commits into shiny_app branch
- Loading branch information
Showing
172 changed files
with
3,830 additions
and
2,203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Run r cmd check | ||
name: call-r-cmd-check | ||
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
# The default build trigger is to run the action on every push and pull request, for any branch | ||
push: | ||
# To run the default repository branch weekly on sunday, uncomment the following 2 lines | ||
#schedule: | ||
#- cron: '0 0 * * 0' | ||
jobs: | ||
call-workflow: | ||
uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# updates exiting pkgdown site for a repository | ||
# deploys to a branch gh-pages | ||
name: call-update-pkgdown | ||
# on specifies the build triggers. See more info at https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows | ||
on: | ||
# this workflow runs on pushes to main or master or any time a new tag is pushed | ||
# workflow_dispatch: | ||
push: | ||
# branches: [main, master] | ||
# tags: ['*'] | ||
jobs: | ||
call-workflow: | ||
uses: nmfs-fish-tools/ghactions4r/.github/workflows/update-pkgdown.yml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
.Rhistory | ||
.RData | ||
.Ruserdata | ||
StockAssessment/*/ | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ export(Weight) | |
export(add_object) | ||
export(read_in) | ||
export(shiny_dd) | ||
export(validate_Rd) | ||
import(tools) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#' Projection | ||
#' | ||
#' A probabilistic statement about future events based on what might happen. | ||
#' | ||
#' @format | ||
#' \describe{ | ||
#' \item{Examples}{short-term projection} | ||
#' \item{Rationale}{Future weather is a forecast because it does not require | ||
#' an if statement, whereas future spawning biomass is a projection because | ||
#' it depends on an assumption about future catches.} | ||
#' \item{Alternatives}{forecast, prediction} | ||
#' \item{Range of possible values}{} | ||
#' \item{Units}{} | ||
#' } | ||
Projection <- NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#' Function to validate terms in the dictionary. | ||
#' | ||
#' The dictionary terms are written in R documentation (Rd) format. | ||
#' This function reads the Rd file using the `tools::parse_Rd` function | ||
#' validate the information in each section (e.g., examples, rationale, | ||
#' range of possible values, etc.). | ||
#' | ||
#' @param Rd_file a Rd filename to use as input. | ||
#' @return a message if the term passes all validations. | ||
#' @import tools | ||
#' @export | ||
validate_Rd <- function(Rd_file) { | ||
if (is.null(Rd_file)) stop("Please provide the path to the R documentation (Rd) file.") | ||
|
||
Rd <- tools::parse_Rd(Rd_file) | ||
tags <- tools:::RdTags(Rd) | ||
|
||
# Validate name | ||
name <- Rd[[which(tags == "\\name")]] | ||
if (is.null(name[[1]][1])) stop("Name is not provided. This should be the basename of the Rd file.") | ||
|
||
# Validate title | ||
title <- Rd[[which(tags == "\\title")]] | ||
if (is.null(title[[1]][1])) stop("Title is not provided. Title should be capitalized and not end in a period.") | ||
|
||
# Validate description | ||
description <- Rd[[which(tags == "\\description")]] | ||
if (gsub("[\r\n]", "", description[[2]][1]) == title[[1]][1] | | ||
is.null(description[[1]][1])) { | ||
stop("Description is not provided. This should be capitalized and not end in a period.") | ||
} | ||
|
||
# Extract format section for validating examples, rationale, alternatives, range of possible values, and units | ||
format <- Rd[[which(tags == "\\format")]][[2]] | ||
items <- c("Examples", "Rationale", "Alternatives", "Range of possible values", "Units") | ||
missing_items <- items[!is.element(items, unlist(format))] | ||
if (any(!is.element(items, unlist(format)))) stop(paste("Missing", paste(missing_items, collapse = ", "))) | ||
|
||
# Validate examples | ||
if (format[[2]][[1]][[1]][1] == "Examples" & | ||
length(format[[2]][[2]]) == 0) { | ||
stop("Examples are not provided. Use NA if there is no input for examples.") | ||
} | ||
|
||
# Validate rationale | ||
if (format[[4]][[1]][[1]][1] == "Rationale" & | ||
length(format[[4]][[2]]) == 0) { | ||
stop("Rationale is not provided.") | ||
} | ||
|
||
# Validate alternatives | ||
if (format[[6]][[1]][[1]][1] == "Alternatives" & | ||
length(format[[6]][[2]]) == 0) { | ||
stop("Alternatives are not provided. Use NA if there is no input for alternatives.") | ||
} | ||
|
||
# Validate range of possible values | ||
if (format[[8]][[1]][[1]][1] == "Range of possible values" & | ||
length(format[[8]][[2]]) == 0) { | ||
stop("Range of possible values is not provided. Use NA if there is no input for range of possible values.") | ||
} | ||
|
||
# Validate range of possible values | ||
if (format[[10]][[1]][[1]][1] == "Units" & | ||
length(format[[10]][[2]]) == 0) { | ||
stop("Units are not provided. Use NA if there is no input for units.") | ||
} | ||
|
||
|
||
# Return a message if the term passes all validations | ||
message(paste("Term", name[[1]][1], "has passed all validations!")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.