diff --git a/CRAN-RELEASE b/CRAN-RELEASE index 27688c2..8dc67be 100644 --- a/CRAN-RELEASE +++ b/CRAN-RELEASE @@ -1,2 +1,2 @@ -This package was submitted to CRAN on 2021-01-19. -Once it is accepted, delete this file and tag the release (commit 69a85e5). +This package was submitted to CRAN on 2021-03-14. +Once it is accepted, delete this file and tag the release (commit 6979905). diff --git a/R/add_common_aes.R b/R/add_common_aes.R index 09de6e4..00a526e 100644 --- a/R/add_common_aes.R +++ b/R/add_common_aes.R @@ -20,6 +20,7 @@ #' for how to modify this. #' @param ... further arguments to plot. #' This is not used by \code{dampack} but required for generic consistency. +#' @return a \code{ggplot2} plot updated with a common aesthetic #' #' @import ggplot2 #' @keywords internal @@ -104,6 +105,7 @@ add_common_aes <- function(gplot, txtsize, scale_name = waiver(), #' used to automatically label continuous scales #' @keywords internal #' @param x axis breaks +#' @return a character vector giving a label for each input value labfun <- function(x) { if (any(x > 999, na.rm = TRUE)) { comma(x) @@ -120,6 +122,7 @@ labfun <- function(x) { #' \code{ggplot2} plots. Non-integer values are rounded down. #' @section Details: #' Based on function \code{pretty}. +#' @return a vector of axis-label breaks #' @keywords internal number_ticks <- function(n) { function(limits) { diff --git a/R/calculate_outcome.R b/R/calculate_outcome.R index 8e9b5e0..024893d 100644 --- a/R/calculate_outcome.R +++ b/R/calculate_outcome.R @@ -4,7 +4,7 @@ #' @param cost data frame with costs #' @param effect data frame with effects #' @param wtp willingness-to-pay threshold -#' +#' @return a data.frame of the desired outcome values for each strategy #' @keywords internal calculate_outcome <- function(outcome = c("nhb", "nmb", "eff", "cost", "nhb_loss", "nmb_loss", "nhb_loss_voi", "nmb_loss_voi"), diff --git a/R/create_sa.R b/R/create_sa.R index 93d1112..84f6c7e 100644 --- a/R/create_sa.R +++ b/R/create_sa.R @@ -20,6 +20,8 @@ #' in the \code{\link{make.names}} help page, to avoid unexpected errors. #' #' @param currency symbol for the currency being used (ex. "$", "£") +#' @return returns "sa" sensitivity analysis object. +#' @keywords internal create_sa <- function(parameters, parnames, effectiveness, strategies, cost, currency, other_outcome) { # checks that each is a dataframe diff --git a/R/evsi.R b/R/evsi.R index b1bba85..42b6a17 100644 --- a/R/evsi.R +++ b/R/evsi.R @@ -120,6 +120,8 @@ calc_evsi <- function(psa, #' @param object gam object #' @param n scalar or vector of new sample size to compute evsi on #' @param n0 scalar or vector of effective prior sample size +#' @return the conditional loss associated with a gam, effective prior sample size, +#' and new sample size #' @importFrom stats coef predict_ga <- function(object, n, n0) { # Name of parameters @@ -191,7 +193,7 @@ predict_ga <- function(object, n, n0) { #' basis functions of a smooth for one parameter #' #' @keywords internal -#' +#' @return Pre-posterior for each basis function #' @importFrom mgcv PredictMat predict_smooth_ga <- function(object, param_vals, vrf = 1) { # Produce basis functions for one parameter @@ -219,7 +221,7 @@ predict_smooth_ga <- function(object, param_vals, vrf = 1) { #' the tensor product if more than one parameter is selected #' (Heavily based on function Predict.matrix.tensor.smooth from #' mgcv package) -#' +#' @return tensor product based on list of pre-posterior distributions #' @keywords internal #' @importFrom mgcv tensor.prod.model.matrix Predict.matrix PredictMat predict_matrix_tensor_smooth_ga <- function(object, diff --git a/R/metamodel.R b/R/metamodel.R index 4937954..663bb60 100644 --- a/R/metamodel.R +++ b/R/metamodel.R @@ -135,6 +135,7 @@ metamodel <- function(analysis = c("oneway", "twoway", "multiway"), #' #' @importFrom mgcv gam #' @keywords internal +#' @return a statistical metamodel #' @inheritParams metamodel mm_run_reg <- function(analysis, dep, params, dat, type, poly.order, k) { @@ -430,6 +431,7 @@ predict.metamodel <- function(object, ranges = NULL, nsamp = 100, ...) { #' @param nsamp number of points from the range #' @param psa_paramvals sampled values from the PSA. used to calculate the #' range if none is supplied +#' @return a vector of parameter values spanning the range specified #' @keywords internal make_param_seq <- function(p, ranges, nsamp, psa_paramvals) { p_range <- ranges[[p]] diff --git a/R/owsa.R b/R/owsa.R index e7d710b..9ce9ae5 100644 --- a/R/owsa.R +++ b/R/owsa.R @@ -213,6 +213,7 @@ owsa_tornado <- function(owsa, return = c("plot", "data"), #' transformation for owsa_tornado #' @param offset the offset for the transformation (kind of the new 0) +#' @return offset value supplied to ytrans in \code{add_common_aes} #' @keywords internal #' @importFrom scales trans_new offset_trans <- function(offset = 0) { @@ -322,7 +323,11 @@ owsa_opt_strat <- function(owsa, params = NULL, maximize = TRUE, } } -# check that is owsa object + +#' check that object is owsa object +#' @param obj the object to be checked for the owsa class +#' @return returns TRUE if object is "owsa" object and FALSE if not. +#' @keywords internal is_owsa <- function(obj) { if (inherits(obj, "owsa")) { return(TRUE) diff --git a/R/run_dsa.R b/R/run_dsa.R index 391e357..1b448b8 100644 --- a/R/run_dsa.R +++ b/R/run_dsa.R @@ -341,6 +341,7 @@ run_twsa_det <- function(params_range, params_basecase, nsamp = 40, FUN, outcome #' @param tmp_replace values from predetermined DSA samples that will replace some values in \code{tmp_input} #' #' @importFrom utils setTxtProgressBar +#' @return output of function defined by \code{user_fun} #' @keywords internal wrapper_of_user_model <- function(x, user_fun, param_name, tmp_input, tmp_replace, diff --git a/cran-comments.md b/cran-comments.md index f7b3736..4dbb0a8 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,15 +1,7 @@ ## Resubmission This is a resubmission. In this version I have: -* removed the name of the package from the start of the description. - -* changed the quotes around package title to undirected quotation marks. - -* Added \value to .Rd files regarding exported methods and explained the functions results in the documentation. - -* Unwrapped examples previously wrapped with \dontrun{} - -* removed write.table() and ggsave() function uses from the basic_cea.rmd vignette to comply with CRAN's policies. These were the only offending functions I could find--if there are others that I am overlooking, please let me know and I will happily fix them! +* Added \value to .Rd files regarding exported methods. ## Test environments * local Win install, R 4.0.3 diff --git a/man/add_common_aes.Rd b/man/add_common_aes.Rd index c6cfd92..8503d60 100644 --- a/man/add_common_aes.Rd +++ b/man/add_common_aes.Rd @@ -65,6 +65,9 @@ for how to modify this.} \item{...}{further arguments to plot. This is not used by \code{dampack} but required for generic consistency.} } +\value{ +a \code{ggplot2} plot updated with a common aesthetic +} \description{ Adds aesthetics to all plots to reduce code duplication } diff --git a/man/calculate_outcome.Rd b/man/calculate_outcome.Rd index 88d0aef..b64265f 100644 --- a/man/calculate_outcome.Rd +++ b/man/calculate_outcome.Rd @@ -21,6 +21,9 @@ calculate_outcome( \item{wtp}{willingness-to-pay threshold} } +\value{ +a data.frame of the desired outcome values for each strategy +} \description{ A function that is used to calculate all outcomes } diff --git a/man/create_sa.Rd b/man/create_sa.Rd index f547d0a..e396f2c 100644 --- a/man/create_sa.Rd +++ b/man/create_sa.Rd @@ -34,9 +34,13 @@ the \code{strategies} vector.} \item{currency}{symbol for the currency being used (ex. "$", "£")} } +\value{ +returns "sa" sensitivity analysis object. +} \description{ This function is called by \code{\link{make_psa_obj}}, \code{\link{create_dsa_oneway}}, and \code{\link{create_dsa_oneway}}, and checks the structure of each of the arguments before creating an SA object. } +\keyword{internal} diff --git a/man/is_owsa.Rd b/man/is_owsa.Rd new file mode 100644 index 0000000..636e32e --- /dev/null +++ b/man/is_owsa.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/owsa.R +\name{is_owsa} +\alias{is_owsa} +\title{check that object is owsa object} +\usage{ +is_owsa(obj) +} +\arguments{ +\item{obj}{the object to be checked for the owsa class} +} +\value{ +returns TRUE if object is "owsa" object and FALSE if not. +} +\description{ +check that object is owsa object +} +\keyword{internal} diff --git a/man/labfun.Rd b/man/labfun.Rd index 18f3f46..806b593 100644 --- a/man/labfun.Rd +++ b/man/labfun.Rd @@ -9,6 +9,9 @@ labfun(x) \arguments{ \item{x}{axis breaks} } +\value{ +a character vector giving a label for each input value +} \description{ used to automatically label continuous scales } diff --git a/man/make_param_seq.Rd b/man/make_param_seq.Rd index cebbfa6..83e185d 100644 --- a/man/make_param_seq.Rd +++ b/man/make_param_seq.Rd @@ -16,6 +16,9 @@ make_param_seq(p, ranges, nsamp, psa_paramvals) \item{psa_paramvals}{sampled values from the PSA. used to calculate the range if none is supplied} } +\value{ +a vector of parameter values spanning the range specified +} \description{ make a parameter sequence } diff --git a/man/mm_run_reg.Rd b/man/mm_run_reg.Rd index cac4cb8..3980f83 100644 --- a/man/mm_run_reg.Rd +++ b/man/mm_run_reg.Rd @@ -29,6 +29,9 @@ Default: 2} \item{all_params}{all params in PSA} } +\value{ +a statistical metamodel +} \description{ Build formula and run linear regression for metamodel } diff --git a/man/number_ticks.Rd b/man/number_ticks.Rd index 88e3202..2264dfc 100644 --- a/man/number_ticks.Rd +++ b/man/number_ticks.Rd @@ -10,6 +10,9 @@ number_ticks(n) \item{n}{integer giving the desired number of ticks on axis of \code{ggplot2} plots. Non-integer values are rounded down.} } +\value{ +a vector of axis-label breaks +} \description{ Function for determining number of ticks on axis of \code{ggplot2} plots. } diff --git a/man/offset_trans.Rd b/man/offset_trans.Rd index f2cd3df..f1c6b5b 100644 --- a/man/offset_trans.Rd +++ b/man/offset_trans.Rd @@ -9,6 +9,9 @@ offset_trans(offset = 0) \arguments{ \item{offset}{the offset for the transformation (kind of the new 0)} } +\value{ +offset value supplied to ytrans in \code{add_common_aes} +} \description{ transformation for owsa_tornado } diff --git a/man/predict_ga.Rd b/man/predict_ga.Rd index ff347ae..a9e81be 100644 --- a/man/predict_ga.Rd +++ b/man/predict_ga.Rd @@ -14,6 +14,10 @@ predict_ga(object, n, n0) \item{n0}{scalar or vector of effective prior sample size} } +\value{ +the conditional loss associated with a gam, effective prior sample size, +and new sample size +} \description{ Function to compute the preposterior for each of the basis functions of the GAM model. diff --git a/man/predict_matrix_tensor_smooth_ga.Rd b/man/predict_matrix_tensor_smooth_ga.Rd index 6d0ac05..2e9054c 100644 --- a/man/predict_matrix_tensor_smooth_ga.Rd +++ b/man/predict_matrix_tensor_smooth_ga.Rd @@ -10,6 +10,9 @@ predict_matrix_tensor_smooth_ga( vrf = rep(1, ncol(param_vals)) ) } +\value{ +tensor product based on list of pre-posterior distributions +} \description{ Function to compute the preposterior for each of the basis functions for one or more parameters and calculates diff --git a/man/predict_smooth_ga.Rd b/man/predict_smooth_ga.Rd index 2cd5338..3237dee 100644 --- a/man/predict_smooth_ga.Rd +++ b/man/predict_smooth_ga.Rd @@ -7,6 +7,9 @@ basis functions of a smooth for one parameter} \usage{ predict_smooth_ga(object, param_vals, vrf = 1) } +\value{ +Pre-posterior for each basis function +} \description{ Function to compute the preposterior for each of the basis functions of a smooth for one parameter diff --git a/man/wrapper_of_user_model.Rd b/man/wrapper_of_user_model.Rd index 9a25801..555dc05 100644 --- a/man/wrapper_of_user_model.Rd +++ b/man/wrapper_of_user_model.Rd @@ -26,6 +26,9 @@ wrapper_of_user_model( \item{tmp_replace}{values from predetermined DSA samples that will replace some values in \code{tmp_input}} } +\value{ +output of function defined by \code{user_fun} +} \description{ Wrapper function for owsa_det and twsa_det }