Skip to content

Commit

Permalink
Ensure that all functions include a description of the values returned
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRegular committed Sep 18, 2023
1 parent 28daf1f commit d2f1de2
Show file tree
Hide file tree
Showing 31 changed files with 101 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.1.6
Date: 2023-09-15 18:15:02 UTC
SHA: 03782485a4ec155145da49da0476c498a1b019e2
Date: 2023-09-18 14:42:04 UTC
SHA: 28daf1f7c21db3a333d9752661e1771ca4d259bb
4 changes: 4 additions & 0 deletions R/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#'
#' @export
#'
#' @return Returns a Fibonacci sequence as a vector.
#'
#' @examples
#'
#' fibonacci(2, 200)
Expand Down Expand Up @@ -44,6 +46,8 @@ fibonacci <- function(from, to) {
#' @param x an \code{R} object
#' @param units the units to be used in printing the size
#'
#' @return Returns a character with the object size followed by the unit.
#'
#' @export
#'

Expand Down
2 changes: 2 additions & 0 deletions R/icc.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#' @param x Response variable
#' @param group Group
#'
#' @return Returns estimate of intraclass correlation.
#'
#' @export
#'

Expand Down
2 changes: 2 additions & 0 deletions R/plot_sim.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#' @import plotly
#' @importFrom rlang .data
#'
#' @return Returns a plot of class \code{plotly}.
#'
#' @export
#' @rdname plot_trend
plot_trend <- function(sim, sum_ages = sim$ages, col = viridis::viridis(1), ...) {
Expand Down
5 changes: 5 additions & 0 deletions R/run_strat.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ error_stats <- function(error) {
#' @param alk_scale Spatial scale at which to construct and apply age-length-keys:
#' "division", "strat" or "set".
#'
#' @return Returns a list including set details (\code{setdet}), length-frequencies (\code{lf}),
#' and age-frequencies (\code{af}).
#'
#' @export
#'

Expand Down Expand Up @@ -124,6 +127,8 @@ strat_data <- function(sim, length_group = 3, alk_scale = "division") {
#' @param survey_groups Grouping variables for large-scale summary calculations. e.g. ("year","species")
#' @param confidence Percent for confidence limits
#'
#' @return Returns a data.table including stratified estimates of abundance.
#'
#' @export
#'

Expand Down
6 changes: 6 additions & 0 deletions R/sim_dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#' @param group_years Make space-age-year noise equal across these years
#' @param model String indicating either "exponential" or "matern" as the correlation function
#'
#' @return Returns a function for use inside \code{\link{sim_distribution}}.
#'
#' @export

sim_ays_covar <- function(sd = 2.8, range = 300, lambda = 1, model = "matern",
Expand Down Expand Up @@ -169,6 +171,8 @@ sim_ays_covar <- function(sd = 2.8, range = 300, lambda = 1, model = "matern",
#' forces very low values near zero.
#' @param plot Produce a simple plot of the simulated values?
#'
#' @return Returns a function for use inside \code{\link{sim_distribution}}.
#'
#' @examples
#'
#' parabola_fun <- sim_parabola(mu = 50, sigma = 5, plot = TRUE)
Expand Down Expand Up @@ -242,6 +246,8 @@ sim_parabola <- function(alpha = 0, mu = 200, sigma = 70, sigma_right = NULL,
#' included in argument \code{coeff} as a named list.
#' @param coeff Named list of coefficient values used in \code{formula}.
#'
#' @return Returns a function for use inside \code{\link{sim_distribution}}.
#'
#' @export
#'
#' @examples
Expand Down
2 changes: 2 additions & 0 deletions R/sim_dist_spde.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ sim_ays_covar_spde <- function(sd = 2.8,
#' @param cutoff Minimum distance allowed between points
#' @param ... Other options to pass to inla.mesh.2d
#'
#' @return Returns an object of class \code{inla.mesh}.
#'
#' @examples
#'
#' \donttest{
Expand Down
8 changes: 7 additions & 1 deletion R/sim_pop.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#' sim_Z does the same as sim_R when phi_age and phi_year are both 0, otherwise values are correlated
#' in the age and/or year dimension. The covariance structure follows that described in Cadigan (2015).
#'
#' @return Returns a function for use inside \code{\link{sim_abundance}}.
#'
#' @references Cadigan, Noel G. 2015. A State-Space Stock Assessment Model for Northern Cod,
#' Including Under-Reported Catches and Variable Natural Mortality Rates. Canadian Journal of
#' Fisheries and Aquatic Sciences 73 (2): 296-308.
Expand Down Expand Up @@ -138,6 +140,8 @@ sim_N0 <- function(N0 = "exp", plot = FALSE) {
#' @param length Interval from \code{\link[base]{findInterval}}
#' @param group Length group used to cut the length data
#'
#' @return Returns a vector indicating the mid-point of the length group.
#'
#' @export
#'

Expand Down Expand Up @@ -168,6 +172,8 @@ group_lengths <- function(length, group) {
#' @param digits Integer indicating the number of decimal places to round the values to
#' @param plot Produce a simple plot of the simulated values?
#'
#' @return Returns a function for use inside \code{\link{sim_abundance}}.
#'
#' @examples
#' growth_fun <- sim_vonB(Linf = 100, L0 = 5, K = 0.2, log_sd = 0.05, length_group = 1, plot = TRUE)
#' growth_fun(age = rep(1:15, each = 100))
Expand Down Expand Up @@ -223,7 +229,7 @@ sim_vonB <- function(Linf = 120, L0 = 5, K = 0.1, log_sd = 0.1,
#' @param N_at_age Abundance-at-age matrix
#' @param lak Length-age-key (i.e. probability of being in a specific length group given age)
#'
#' @return Returns abundance-at-length matrix
#' @return Returns abundance-at-length matrix.
#'
#' @export
#'
Expand Down
8 changes: 8 additions & 0 deletions R/sim_survey.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#' @param x0 The x-value of the sigmoid's midpoint
#' @param plot Plot relationship
#'
#' @return Returns a function for use in \code{\link{sim_survey}}.
#'
#' @examples
#' logistic_fun <- sim_logistic(k = 2, x0 = 3, plot = TRUE)
#' logistic_fun(x = 1:10)
Expand All @@ -28,6 +30,8 @@ sim_logistic <- function(k = 2, x0 = 3, plot = FALSE) {
#'
#' @param sim Simulation from \code{\link{sim_distribution}}
#'
#' @return Returns a rounded simulation object. Largely used as a helper in \code{\link{sim_survey}}.
#'
#' @export
#'

Expand Down Expand Up @@ -60,6 +64,8 @@ round_sim <- function(sim) {
#' (Note: allowing resampling may create bias because
#' depletion is imposed at the cell level)
#'
#' @return Returns a data.table including details of each set location.
#'
#' @export
#'
#' @examples
Expand Down Expand Up @@ -317,6 +323,8 @@ sim_survey <- function(sim, n_sims = 1, q = sim_logistic(), trawl_dim = c(1.5, 0
#'
#' @details \code{\link{sim_survey}} is hard-wired here to be "light" to minimize object size.
#'
#' @return Returns an object of the same structure as \code{\link{sim_survey}}.
#'
#' @examples
#'
#' \donttest{
Expand Down
2 changes: 2 additions & 0 deletions R/test_surveys.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#' @param ages_cap Vector of maximum number of otoliths to collect per length group
#' per division per year
#'
#' @return Returns a data.frame including all combinations of the supplied vectors.
#'
#' @export
#'

Expand Down
2 changes: 2 additions & 0 deletions R/vis_sim.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' \code{\link{sim_survey}} or \code{\link{test_surveys}}.
#' @param ... Additional arguments to send to \link[rmarkdown]{run}
#'
#' @return No value returned; function produces an interactive dashboard.
#'
#' @examples
#'
#' \donttest{
Expand Down
2 changes: 1 addition & 1 deletion man/convert_N.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/expand_surveys.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/fibonacci.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/group_lengths.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/icc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/make_mesh.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/object_size.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/plot_trend.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/round_sim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/sim_R.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/sim_ays_covar.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/sim_logistic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/sim_nlf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/sim_parabola.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/sim_sets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/sim_survey_parallel.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/sim_vonB.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/strat_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/strat_means.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/vis_sim.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d2f1de2

Please sign in to comment.