Skip to content

Commit

Permalink
minor edits to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertASmith committed Aug 30, 2024
1 parent 1bddeb3 commit 918cec8
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 48 deletions.
33 changes: 16 additions & 17 deletions R/check_PSAstability.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,32 @@
#' @importFrom tidyr pivot_longer
#'
#' @examples
#'
#' \dontrun{
#' # create example matrices
#' m_eff <- as.matrix(gskVEOutils::Hyperphosphatemia_PSA$e)[,1:5]
#' colnames(m_eff) <- LETTERS[1:length(colnames(m_eff))]
#' n_psa <- 10000
#'
#' m_cost <- as.matrix(gskVEOutils::Hyperphosphatemia_PSA$c)[,1:5]
#' colnames(m_cost) <- LETTERS[1:length(colnames(m_cost))]
#' m_eff <- matrix(data = runif(n = n_psa * 4, min = 0, max = 1),
#' nrow = n_psa,
#' ncol = 4,
#' dimnames = list(NULL, paste0("Strategy ", c("A", "B", "C", "D"))))
#'
#' v_strategy_labels <- setNames(object = paste0("Strategy ", colnames(m_eff)),
#' nm = colnames(m_eff))
#' m_cost <- matrix(data = runif(n = n_psa * 4, min = 5000, max = 20000),
#' nrow = n_psa,
#' ncol = 4,
#' dimnames = list(NULL, paste0("Strategy ", c("A", "B", "C", "D"))))
#'
#' v_strategy_colors <- setNames(object = grDevices::palette.colors(n = ncol(m_eff)),
#' nm = colnames(m_eff))
#'
#' plot_PSA_stability(m_eff = m_eff[, 1:5],
#' m_cost = m_cost[, 1:5],
#' plot_PSA_stability(m_eff = m_eff,
#' m_cost = m_cost,
#' lambda = 20000,
#' currency_symbol = "\u0024",
#' v_strategy_labels = v_strategy_labels,
#' v_strategy_labels = colnames(m_eff),
#' v_strategy_colors = v_strategy_colors,
#' comparator = colnames(m_eff)[1],
#' output = "icer",
#' include_reference_line = T,
#' log_x = F)
#'
#' } # end don't run.
#' output = "inmb",
#' include_reference_line = TRUE,
#' log_x = FALSE)
#'
plot_PSA_stability <- function(m_eff,
m_cost,
Expand All @@ -59,7 +58,7 @@ plot_PSA_stability <- function(m_eff,
comparator = NULL,
output = "inmb",
include_reference_line = T,
log_x = F) {
log_x = FALSE) {
assertthat::assert_that(is.matrix(m_eff) &
is.matrix(m_cost) & is.numeric(m_eff) & is.numeric(m_cost),
msg = "m_eff and m_cost must be numeric matrices")
Expand Down
5 changes: 3 additions & 2 deletions R/check_trans_probs.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#' @param dead_state character vector length 1 denoting dead state (e.g. "D")
#'
#' @examples
#' \dontrun{
#' v_hs_names <- c("H", "S", "D")
#' n_hs <- length(v_hs_names)
#' m_P <- matrix(data = 0, nrow = n_hs, ncol = n_hs,
Expand All @@ -22,9 +21,11 @@
#' m_P["S", "H"] <- 0.5
#' diag(m_P) <- (1 - rowSums(m_P))
#' check_trans_prob_mat(m_P)
#'
#' \dontrun{
#' # introduce error
#' m_P["H", "S"] <- 0.2
#' check_trans_prob_mat(m_P, confirm_ok = T, stop_if_not = T)
#' check_trans_prob_mat(m_P, confirm_ok = TRUE, stop_if_not = TRUE)
#' }
#'
#' @return A message indicating whether the matrix passed all the checks or a warning/error message if any check failed.
Expand Down
6 changes: 2 additions & 4 deletions R/cheers_checker.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
#' @return The next element of the vector after the value
#' @export
#' @examples
#' \dontrun{
#' find_next_vector_element(value = 5, vector = 1:10)
#' find_next_vector_element(value = 5, vector = 1:4)
#' find_next_vector_element(value = 5, vector = 1:5, LTE = F)
#' find_next_vector_element(value = 5, vector = 1:5, LTE = T)
#' }
#' find_next_vector_element(value = 5, vector = 1:5, LTE = FALSE)
#' find_next_vector_element(value = 5, vector = 1:5, LTE = TRUE)
#'
find_next_vector_element <- function(value, vector, LTE=FALSE) {

Expand Down
5 changes: 3 additions & 2 deletions man/check_trans_prob_mat.Rd

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

6 changes: 2 additions & 4 deletions man/find_next_vector_element.Rd

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

33 changes: 16 additions & 17 deletions man/plot_PSA_stability.Rd

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

4 changes: 2 additions & 2 deletions tests/testthat/test-check_PSAstability.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test_that("plot_PSA_stability handles valid input", {
comparator = colnames(m_eff)[1],
output = "icer",
include_reference_line = T,
log_x = F
log_x = FALSE
)
})

Expand Down Expand Up @@ -121,7 +121,7 @@ test_that("plot_PSA_stability flags errors", {
comparator = colnames(m_eff)[1],
output = "icer",
include_reference_line = T,
log_x = F
log_x = FALSE
)
})

Expand Down

0 comments on commit 918cec8

Please sign in to comment.