Skip to content

Commit

Permalink
Small tweaks for CRAN (#277)
Browse files Browse the repository at this point in the history
* missed one DOI

* edge case tests

* hide other misc folders
  • Loading branch information
mattsecrest authored Mar 22, 2024
1 parent 8f0b28a commit 5123a8c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ README.*
coverage.*
^codemeta\.json$
devel
develop
^design$
^data-raw$
^doc$
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/.project
articles
devel/*
develop/
doc
docs
inst/outputs/*
Expand Down
9 changes: 4 additions & 5 deletions R/borrowing_hierarchical_commensurate.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@
#' In Bayesian dynamic borrowing using the hierarchical commensurate prior approach,
#' external control information is borrowed to the extent that the
#' outcomes (i.e., log hazard rates or log odds) are similar between
#' external and internal control populations. See
#' \href{https://doi.org/10.1002/pst.1589}{Viele et. al. 2014} and
#' \href{https://doi.org/10.1111/j.1541-0420.2011.01564.x}{Hobbs et. al. 2011}
#' for details.
#' external and internal control populations. See Viele 2014
#' \doi{10.1002/pst.1589} and Hobbs 2011
#' \doi{10.1111/j.1541-0420.2011.01564.x} for details.
#'
#' ## External Control
#'
Expand All @@ -56,7 +55,7 @@
#'
#' The `tau_prior` argument specifies the hyperprior on the precision parameter
#' commonly referred to as the commensurability parameter.
#' See \href{https://doi.org/10.1002/pst.1589}{Viele et. al. 2014} for more
#' See Viele 2014 \doi{10.1002/pst.1589} for more
#' details.
#' This hyperprior determines (along with the comparability of the outcomes
#' between internal and external controls) how much borrowing of the external
Expand Down
2 changes: 1 addition & 1 deletion R/cmdstan.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ is_cmdstanr_available <- function() {
#' check_cmdstanr()
check_cmdstanr <- function(check_sampling = FALSE) {
if (!is_cmdstanr_available()) {
cat("cmdstanr is not installed. \n")
cat("cmdstanr is not installed or is installed but not configured. \n")
} else {
cat("cmdstanr is installed.\n")
cat("cmdstanr version: \n")
Expand Down
2 changes: 1 addition & 1 deletion R/create_analysis_obj.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ create_analysis_obj <- function(data_matrix,
analysis_obj@model_string <- stan_model_string

# Compile model
if (is_cmdstanr_available()) {
if (check_cmdstan()) {
stan_file <- cmdstanr::write_stan_file(analysis_obj@model_string)
if (!quiet) {
analysis_obj@model <- cmdstanr::cmdstan_model(stan_file)
Expand Down
9 changes: 4 additions & 5 deletions man/borrowing_hierarchical_commensurate.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-analysis_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ test_that("show works with no borrowing", {


test_that("get_stan_code works when cmdstanr isn't available", {
skip_if(is_cmdstanr_available())
skip_if(check_cmdstan())
expect_warning(
object <- create_analysis_obj(
data_matrix = example_matrix,
Expand Down Expand Up @@ -162,7 +162,7 @@ beta[2] ~ normal(0, 1000) ;


test_that("get_stan_code works when cmdstanr is available", {
skip_if(!is_cmdstanr_available())
skip_if_not(check_cmdstan())
object <- create_analysis_obj(
data_matrix = example_matrix,
covariates = add_covariates(
Expand Down

0 comments on commit 5123a8c

Please sign in to comment.