From 9b63afa35f0f3cd4383e0b11a3355a7561da4c5f Mon Sep 17 00:00:00 2001 From: Bai Li Date: Thu, 19 Oct 2023 16:53:14 -0400 Subject: [PATCH] update documentation --- DESCRIPTION | 9 ++++++--- NAMESPACE | 5 +++++ R/add_object.R | 2 ++ R/make_hex.R | 4 ++++ R/shiny_dd.r | 1 + R/validate_Rd.R | 2 +- man/Catch.Rd | 2 +- man/make_hex.Rd | 14 ++++++++++++++ 8 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 man/make_hex.Rd diff --git a/DESCRIPTION b/DESCRIPTION index b002ddb..62a0d0c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,14 +5,17 @@ Authors@R: person("First", "Last", , "first.last@example.com", role = c("aut", "cre"), comment = c(ORCID = "YOUR-ORCID-ID")) Description: What the package does (one paragraph). -License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a - license +License: GPL (>= 3) | file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 Imports: mvbutils, - tools + tools, + hexSticker, + jsonlite, + jsonvalidate, + shiny Suggests: testthat (>= 3.0.0) Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index bd3aacd..c2d5178 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,3 +9,8 @@ export(read_in) export(shiny_dd) export(validate_Rd) import(tools) +importFrom(hexSticker,sticker) +importFrom(jsonlite,fromJSON) +importFrom(jsonlite,toJSON) +importFrom(jsonvalidate,json_validate) +importFrom(shiny,runApp) diff --git a/R/add_object.R b/R/add_object.R index c96ad09..d5f24e5 100644 --- a/R/add_object.R +++ b/R/add_object.R @@ -3,6 +3,8 @@ #' @param input_list A list of fields corresponding to entries. Must include #' \code{name,description,Examples, Units, Rationale, Alternatives, Range of possible values} #' @return An R list in the JSON format which includes the new term. +#' @importFrom jsonlite fromJSON toJSON +#' @importFrom jsonvalidate json_validate #' @export add_object <- function(input_list) { json_obj <- jsonlite::fromJSON(system.file("extdata","top20.json", package = "stockassessmentdictionary")) diff --git a/R/make_hex.R b/R/make_hex.R index 1c0b046..151eb95 100644 --- a/R/make_hex.R +++ b/R/make_hex.R @@ -1,3 +1,7 @@ +#' Create a hexagonal sticker for the 'fishdictionary' package. +#' +#' @importFrom hexSticker sticker +#' @return The function does not return any value but creates a hexagonal sticker image. make_hex <- function(){ hexSticker::sticker(paste0("./static/pictures/", c("nounbook.png","nounfish.png")), package="fishdictionary", p_size=20, s_x=c(1,1), s_y=c(.4,.9), diff --git a/R/shiny_dd.r b/R/shiny_dd.r index bfecbce..705e538 100644 --- a/R/shiny_dd.r +++ b/R/shiny_dd.r @@ -1,6 +1,7 @@ #' Run the data dictionary app #' #' Run the data dictionary app +#' @importFrom shiny runApp #' @export #' @param browse Logical. Use browser for running Shiny app. #' @examples diff --git a/R/validate_Rd.R b/R/validate_Rd.R index f771ea5..ee815ae 100644 --- a/R/validate_Rd.R +++ b/R/validate_Rd.R @@ -13,7 +13,7 @@ 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) + tags <- lapply(Rd, attr, "Rd_tag") # Validate name name <- Rd[[which(tags == "\\name")]] diff --git a/man/Catch.Rd b/man/Catch.Rd index c093698..8d8942c 100644 --- a/man/Catch.Rd +++ b/man/Catch.Rd @@ -10,7 +10,7 @@ \item{Rationale}{Landings and catch are sometimes thought to be interchangeable but they are not given that catch can also include bycatch or unwanted catch.} -\item{Alternatives}{total mortality} +\item{Alternatives}{total mortality, harvest, total removals} \item{Range of possible values}{0--Inf} \item{Units}{mt, numbers} } diff --git a/man/make_hex.Rd b/man/make_hex.Rd new file mode 100644 index 0000000..2ce2ee1 --- /dev/null +++ b/man/make_hex.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/make_hex.R +\name{make_hex} +\alias{make_hex} +\title{Create a hexagonal sticker for the 'fishdictionary' package.} +\usage{ +make_hex() +} +\value{ +The function does not return any value but creates a hexagonal sticker image. +} +\description{ +Create a hexagonal sticker for the 'fishdictionary' package. +}