Skip to content

Commit

Permalink
redo of examples
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewphamilton committed Jul 4, 2024
1 parent 233587b commit 5e61b11
Show file tree
Hide file tree
Showing 31 changed files with 950 additions and 666 deletions.
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
cff-version: 1.2.0
message: "Matthew P Hamilton (2024). ready4: Develop and Use Modular Health Economic Models. Version 0.1.12. Zenodo. https://doi.org/10.5281/zenodo.5606250"
message: "Matthew P Hamilton (2024). ready4: Develop and Use Modular Health Economic Models. Version 0.1.13. Zenodo. https://doi.org/10.5281/zenodo.5606250"
authors:
- family-names: "Hamilton"
given-names: "Matthew P"
title: "ready4: Develop and Use Modular Health Economic Models"
version: 0.1.12
version: 0.1.13
doi: 10.5281/zenodo.5606250
date-released: 2024-07-04
date-released: 2024-07-05
url: "https://ready4-dev.github.io/ready4/"
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.1.9
Date: 2024-04-15 11:10:46 UTC
SHA: 3fb2975f30abb3a753d7d22f7781862c91b4e287
Version: 0.1.12
Date: 2024-07-04 19:38:43 UTC
SHA: 3b7cc823fa3a88283d57502358e888e0a7688d2c
31 changes: 11 additions & 20 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Description: A template model module, tools to help find model modules
use it visit <https://www.ready4-dev.com/>. For a background to the
methodological issues that the framework is attempting to help solve,
see Hamilton et al. (2024) <doi:10.1007/s40273-024-01378-8>.
License: GPL-3 + file LICENSE
License: GPL-3
URL: https://ready4-dev.github.io/ready4/,
https://github.com/ready4-dev/ready4, https://www.ready4-dev.com/
Encoding: UTF-8
Expand All @@ -29,8 +29,6 @@ Collate:
'C4_Ready4Module.R'
'C4_Ready4Private.R'
'C4_Ready4Public.R'
'add.R'
'bind.R'
'fn_add.R'
'fn_bind.R'
'fn_get.R'
Expand All @@ -41,11 +39,9 @@ Collate:
'fn_transform.R'
'fn_update.R'
'fn_write.R'
'get.R'
'grp_generics.R'
'imp_fns.R'
'imp_mthds.R'
'make.R'
'mthd_authorSlot.R'
'mthd_characterizeSlot.R'
'mthd_depictSlot.R'
Expand All @@ -62,34 +58,31 @@ Collate:
'mthd_renewSlot.R'
'mthd_shareSlot.R'
'pkg_ready4.R'
'print.R'
'ready4-package.R'
'remove.R'
'rowbind.R'
'transform.R'
'update.R'
'write.R'
Suggests:
devtools,
Hmisc,
knitr,
testthat
pkgload,
readr,
readxl,
rmarkdown,
testthat,
usethis,
zen4R
VignetteBuilder: knitr
Imports:
curl,
dataverse,
devtools,
dplyr,
gh,
Hmisc,
kableExtra,
lifecycle,
magrittr,
methods,
piggyback,
purrr,
readr,
readxl,
rlang,
rmarkdown,
rvest,
stats,
stringi,
Expand All @@ -98,6 +91,4 @@ Imports:
tidyRSS,
tidyselect,
tools,
usethis,
utils,
zen4R
utils
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ready4 0.1.13
This patch updates one of the examples files so that its execution does not breach the CRAN recommended run time limit.

# ready4 0.1.12
This patch updates functions for printing HTML tables to return NULL values if supplied with NULL values instead of tibble objects.
Expand Down
44 changes: 44 additions & 0 deletions R/fn_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ get_cls_extensions <- function (pkg_extensions_tb, gh_repo_1L_chr = "ready4-dev/
#' @importFrom piggyback pb_download_url
#' @keywords internal
#' @example man/examples/get_datasets_tb.R
#' @example man/examples/get_datasets_tb.R
get_datasets_tb <- function (gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_chr = "Documentation_0.0",
rds_fl_name_1L_chr = "datasets_tb")
{
Expand Down Expand Up @@ -323,6 +324,7 @@ get_fl_nm_from_path <- function (path_1L_chr)
#' @importFrom rlang sym
#' @importFrom stringr str_detect str_locate str_sub
#' @example man/examples/get_from_lup_obj.R
#' @example man/examples/get_from_lup_obj.R
get_from_lup_obj <- function (data_lookup_tb, match_value_xx, match_var_nm_1L_chr,
target_var_nm_1L_chr, evaluate_1L_lgl = FALSE)
{
Expand Down Expand Up @@ -478,6 +480,44 @@ get_gh_repos <- function (org_1L_chr)
#' @importFrom purrr map_lgl
#' @importFrom stringr str_detect
#' @example man/examples/get_gracefully.R
#' @examplesIf interactive()
#' # Likely to take more than one minute to execute.
#' get_gracefully(paste0("https://github.com/ready4-dev/ready4/",
#' "releases/download/Documentation_0.0/ready4_badges_lup.RDS"))
#' get_gracefully("DOES NOT EXIST")
#' if(requireNamespace("dataverse", quietly = TRUE)) {
#' get_gracefully("https://doi.org/10.7910/DVN/RIQTKK", fn = dataverse::dataset_files,
#' args_ls = list(key = NULL, server = "dataverse.harvard.edu"))
#' get_gracefully("https://doi.org/10.7910/DVN/RIQTKK", fn = dataverse::dataset_files,
#' args_ls = list(key = NULL, server = "DOES_NOT_EXIST"))
#' get_gracefully("DOES_NOT_EXIST", fn = dataverse::dataset_files,
#' args_ls = list(key = NULL, server = "dataverse.harvard.edu"))
#'
#' }
#' if (requireNamespace("gh", quietly = TRUE)) {
#' get_gracefully("/orgs/ready4-dev/repos", fn = gh::gh, args_ls=list(type = "public"))
#' get_gracefully("DOES_NOT_EXIST", fn = gh::gh, args_ls=list(type = "public"))
#' }
#' if(requireNamespace("piggyback", quietly = TRUE)) {
#' get_gracefully(NULL, fn = piggyback::pb_download_url,
#' args_ls = list(repo = "ready4-dev/ready4",
#' tag = "Documentation_0.0",
#' .token = ""))
#' get_gracefully(NULL, fn = piggyback::pb_download_url,
#' args_ls = list(repo = "DOES_NOT_EXIST",
#' tag = "DOES_NOT_EXIST",
#' .token = ""))
#' }
#' if(requireNamespace("rvest", quietly = TRUE)) {
#' get_gracefully("https://ready4-dev.github.io/ready4/index.html", fn=rvest::read_html)
#' get_gracefully("DOES_NOT_EXIST", fn=rvest::read_html)
#' }
#'
#' if(requireNamespace("tidyRSS", quietly = TRUE)) {
#' get_gracefully("https://github.com/ready4-dev/ready4/releases.atom",
#' fn = tidyRSS::tidyfeed)
#' get_gracefully("DOES_NOT_EXIST", fn = tidyRSS::tidyfeed)
#' }
get_gracefully <- function (url_1L_chr, args_ls = NULL, fn = readRDS, not_chr_1L_lgl = F,
tests_chr = character(0))
{
Expand Down Expand Up @@ -556,6 +596,7 @@ get_libraries_ls <- function (gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_ch
#' @export
#' @importFrom piggyback pb_download_url
#' @example man/examples/get_libraries_tb.R
#' @example man/examples/get_libraries_tb.R
get_libraries_tb <- function (gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_chr = "Documentation_0.0")
{
libraries_tb <- NULL
Expand Down Expand Up @@ -606,6 +647,7 @@ get_manual_urls <- function (pkg_nm_1L_chr = "ready4", pkg_url_1L_chr = "https:/
#' @export
#' @importFrom stringr str_detect str_remove_all
#' @example man/examples/get_methods.R
#' @example man/examples/get_methods.R
get_methods <- function (pkg_nm_1L_chr = "ready4", cls_nm_1L_chr = "Ready4Module")
{
methods_chr <- showMethods(classes = "Ready4Module", printTo = FALSE)
Expand All @@ -626,6 +668,7 @@ get_methods <- function (pkg_nm_1L_chr = "ready4", cls_nm_1L_chr = "Ready4Module
#' @export
#' @importFrom piggyback pb_download_url
#' @example man/examples/get_methods_tb.R
#' @example man/examples/get_methods_tb.R
get_methods_tb <- function (gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_chr = "Documentation_0.0")
{
methods_tb <- NULL
Expand All @@ -648,6 +691,7 @@ get_methods_tb <- function (gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_chr
#' @export
#' @importFrom piggyback pb_download_url
#' @example man/examples/get_modules_tb.R
#' @example man/examples/get_modules_tb.R
get_modules_tb <- function (gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_chr = "Documentation_0.0")
{
modules_tb <- NULL
Expand Down
37 changes: 37 additions & 0 deletions R/fn_make.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ make_additions_tb <- function (category_chr = character(0), library_chr = charac
#' make_code_releases_tbl("Subroutine",
#' gh_repo_1L_chr = "ready4-dev/ready4")
#' }
#' @examplesIf interactive()
#' # Likely to take more than one minute to execute.
#' if(requireNamespace("tidyRSS", quietly = TRUE)) {
#' make_code_releases_tbl("Framework",
#' gh_repo_1L_chr = "ready4-dev/ready4")
#' make_code_releases_tbl("Module",
#' gh_repo_1L_chr = "ready4-dev/ready4")
#' make_code_releases_tbl("Program",
#' gh_repo_1L_chr = "ready4-dev/ready4")
#' make_code_releases_tbl("Subroutine",
#' gh_repo_1L_chr = "ready4-dev/ready4")
#' }
make_code_releases_tbl <- function (repo_type_1L_chr = c("Framework", "Module", "Package",
"Program", "Subroutine", "Program_and_Subroutine"), as_kbl_1L_lgl = TRUE,
brochure_repos_chr = character(0), exclude_chr = character(0),
Expand Down Expand Up @@ -196,6 +208,16 @@ make_code_releases_tbl <- function (repo_type_1L_chr = c("Framework", "Module",
#' make_datasets_tb("ready4", dvs_tb = dvs_tb, type_1L_chr = "datasets")
#' make_datasets_tb("ready4", dvs_tb = dvs_tb, type_1L_chr = "datasets", what_1L_chr = "real")
#' make_datasets_tb("ready4", dvs_tb = dvs_tb, type_1L_chr = "datasets", what_1L_chr = "fakes")
#' @examplesIf interactive()
#' # Likely to take more than one minute to execute.
#' make_datasets_tb("ready4")
#' dvs_tb <- get_datasets_tb("ready4-dev/ready4")
#' make_datasets_tb("ready4", dvs_tb = dvs_tb)
#' make_datasets_tb("ready4", dvs_tb = dvs_tb, what_1L_chr = "real")
#' make_datasets_tb("ready4", dvs_tb = dvs_tb, what_1L_chr = "fakes")
#' make_datasets_tb("ready4", dvs_tb = dvs_tb, type_1L_chr = "datasets")
#' make_datasets_tb("ready4", dvs_tb = dvs_tb, type_1L_chr = "datasets", what_1L_chr = "real")
#' make_datasets_tb("ready4", dvs_tb = dvs_tb, type_1L_chr = "datasets", what_1L_chr = "fakes")
make_datasets_tb <- function (dv_nm_1L_chr = "ready4", dvs_tb = NULL, filter_cdns_ls = NULL,
key_1L_chr = NULL, server_1L_chr = "dataverse.harvard.edu",
toy_data_dv_1L_chr = "fakes", type_1L_chr = c("collections",
Expand Down Expand Up @@ -312,6 +334,7 @@ make_datasets_tb <- function (dv_nm_1L_chr = "ready4", dvs_tb = NULL, filter_cdn
#' @importFrom dplyr arrange desc mutate filter select
#' @importFrom kableExtra cell_spec kable kable_styling
#' @example man/examples/make_ds_releases_tbl.R
#' @example man/examples/make_ds_releases_tbl.R
make_ds_releases_tbl <- function (ds_dois_chr, format_1L_chr = "%d-%b-%Y", key_1L_chr = NULL,
server_1L_chr = "dataverse.harvard.edu", as_kbl_1L_lgl = TRUE,
...)
Expand Down Expand Up @@ -696,6 +719,9 @@ make_local_path_to_dv_data <- function (save_dir_path_1L_chr, fl_nm_1L_chr, save
#' @examplesIf interactive()
#' # Likely to take more than one minute to execute.
#' make_methods_tb(gh_repo_1L_chr = "ready4-dev/ready4")
#' @examplesIf interactive()
#' # Likely to take more than one minute to execute.
#' make_methods_tb(gh_repo_1L_chr = "ready4-dev/ready4")
make_methods_tb <- function (packages_tb = NULL, exclude_mthds_for_chr = NA_character_,
framework_only_1L_lgl = TRUE, gh_repo_1L_chr = "ready4-dev/ready4",
gh_tag_1L_chr = "Documentation_0.0", module_pkgs_chr = character(0),
Expand Down Expand Up @@ -771,6 +797,9 @@ make_modules_pkgs_chr <- function (gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_
#' @examplesIf interactive()
#' # Likely to take more than one minute to execute.
#' make_modules_tb(gh_repo_1L_chr = "ready4-dev/ready4")
#' @examplesIf interactive()
#' # Likely to take more than one minute to execute.
#' make_modules_tb(gh_repo_1L_chr = "ready4-dev/ready4")
make_modules_tb <- function (pkg_extensions_tb = NULL, cls_extensions_tb = NULL,
gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_chr = "Documentation_0.0",
module_pkgs_chr = character(0), include_1L_chr = "modules",
Expand Down Expand Up @@ -917,6 +946,14 @@ make_modules_tb <- function (pkg_extensions_tb = NULL, cls_extensions_tb = NULL,
#' make_programs_tbl("Subroutine",
#' gh_repo_1L_chr = "ready4-dev/ready4")
#' }
#' @examplesIf interactive()
#' # Likely to take more than one minute to execute.
#' if(requireNamespace("zen4R", quietly = TRUE)) {
#' make_programs_tbl("Program",
#' gh_repo_1L_chr = "ready4-dev/ready4")
#' make_programs_tbl("Subroutine",
#' gh_repo_1L_chr = "ready4-dev/ready4")
#' }
make_programs_tbl <- function (what_1L_chr = c("Program", "Subroutine", "Program_and_Subroutine"),
as_kbl_1L_lgl = FALSE, exclude_chr = character(0), format_1L_chr = "%d-%b-%Y",
gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_chr = "Documentation_0.0",
Expand Down
23 changes: 23 additions & 0 deletions R/fn_print.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#' @rdname print_data
#' @export
#' @example man/examples/print_data.R
#' @example man/examples/print_data.R
print_data <- function (datasets_tb, by_dv_1L_lgl = FALSE, filter_cdns_ls = NULL,
root_1L_chr = "https://dataverse.harvard.edu/dataverse/",
scroll_height_1L_chr = character(0), scroll_width_1L_chr = character(0),
Expand Down Expand Up @@ -143,6 +144,7 @@ print_dvs <- function (dvs_tb, filter_cdns_ls = NULL, root_1L_chr = "https://dat
#' @importFrom purrr map_chr
#' @importFrom kableExtra kable kable_styling column_spec
#' @example man/examples/print_methods.R
#' @example man/examples/print_methods.R
print_methods <- function (methods_tb = NULL, exclude_mthds_for_chr = NA_character_,
gh_repo_1L_chr = "ready4-dev/ready4", gh_tag_1L_chr = "Documentation_0.0",
methods_chr = NULL, module_pkgs_chr = character(0), ns_var_nm_1L_chr = "pt_ns_chr",
Expand Down Expand Up @@ -189,6 +191,7 @@ print_methods <- function (methods_tb = NULL, exclude_mthds_for_chr = NA_charact
#' @importFrom dplyr filter select
#' @importFrom kableExtra kable kable_styling
#' @example man/examples/print_modules.R
#' @example man/examples/print_modules.R
print_modules <- function (modules_tb, scroll_height_1L_chr = character(0), scroll_width_1L_chr = character(0),
what_1L_chr = "All", ...)
{
Expand Down Expand Up @@ -255,6 +258,26 @@ print_modules <- function (modules_tb, scroll_height_1L_chr = character(0), scro
#' ## Print module libraries
#' print_packages(gh_repo_1L_chr = "ready4-dev/ready4",
#' include_1L_chr = "modules")
#' @examplesIf interactive()
#' # Method 1
#' libraries_tb <- get_libraries_tb(gh_repo_1L_chr = "ready4-dev/ready4")
#' ## Print framework libraries
#' update_libraries_tb(libraries_tb,
#' url_stub_1L_chr = "https://ready4-dev.github.io/",
#' include_1L_chr = "framework") %>%
#' print_packages()
#' ## Print module libraries
#' update_libraries_tb(libraries_tb,
#' url_stub_1L_chr = "https://ready4-dev.github.io/",
#' include_1L_chr = "modules") %>%
#' print_packages()
#' # Method 2
#' ## Print framework libraries
#' print_packages(gh_repo_1L_chr = "ready4-dev/ready4",
#' include_1L_chr = "framework")
#' ## Print module libraries
#' print_packages(gh_repo_1L_chr = "ready4-dev/ready4",
#' include_1L_chr = "modules")
print_packages <- function (pkg_extensions_tb = NULL, gh_repo_1L_chr = "ready4-dev/ready4",
gh_tag_1L_chr = "Documentation_0.0", include_1L_chr = "modules",
module_pkgs_chr = character(0), ns_var_nm_1L_chr = "pt_ns_chr",
Expand Down
Loading

0 comments on commit 5e61b11

Please sign in to comment.