Skip to content

Commit 74662c8

Browse files
updated mthds
1 parent a796186 commit 74662c8

19 files changed

Lines changed: 143 additions & 61 deletions

DESCRIPTION

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,15 @@ Collate:
119119
'pkg_specific.R'
120120
'specific-package.R'
121121
Suggests:
122-
scorz,
123-
rmarkdown
124-
Remotes:
122+
scorz (>= 0.0.0.9047),
123+
rmarkdown,
124+
betareg,
125+
cmdstanr (>= 0.4.0.9000),
126+
rstan
127+
Remotes:
125128
ready4-dev/ready4,
126129
ready4-dev/ready4show,
127130
ready4-dev/ready4use,
128-
ready4-dev/youthvars
131+
ready4-dev/youthvars,
132+
stan-dev/cmdstanr,
133+
ready4-dev/scorz

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ importFrom(ggplot2,theme_bw)
312312
importFrom(ggplot2,xlim)
313313
importFrom(ggplot2,ylim)
314314
importFrom(here,here)
315+
importFrom(hutils,longest_prefix)
315316
importFrom(kableExtra,add_header_above)
316317
importFrom(kableExtra,collapse_rows)
317318
importFrom(kableExtra,column_spec)
@@ -406,7 +407,6 @@ importFrom(stats,simulate)
406407
importFrom(stringi,stri_locate_first_fixed)
407408
importFrom(stringi,stri_locate_last_fixed)
408409
importFrom(stringi,stri_replace_all_fixed)
409-
importFrom(stringi,stri_replace_first_fixed)
410410
importFrom(stringi,stri_replace_last)
411411
importFrom(stringi,stri_replace_last_fixed)
412412
importFrom(stringi,stri_replace_last_regex)

R/fn_write.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ write_analyses <- function (input_params_ls, abstract_args_ls = NULL, start_at_i
1414
paths_ls = input_params_ls$path_params_ls$paths_ls, rprt_nm_1L_chr = "AAA_PMRY_ANLYS_MTH",
1515
abstract_args_ls = abstract_args_ls, header_yaml_args_ls = input_params_ls$header_yaml_args_ls)
1616
if (!is.null(input_params_ls$scndry_anlys_params_ls)) {
17-
write_secondary_analyses(input_params_ls, abstract_args_ls = abstract_args_ls,
18-
start_at_int = start_at_int)
17+
write_secondary_analyses(input_params_ls)
1918
}
2019
}
2120
#' Write box cox transformation

R/mthd_author.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#' @importFrom ready4show make_paths_ls write_all_outp_dirs
1515
#' @importFrom rlang exec
1616
#' @importFrom youthvars write_descv_tbls write_descv_plots
17+
#' @importFrom hutils longest_prefix
1718
#' @importFrom methods callNextMethod
1819
#' @importFrom ready4 author
1920
methods::setMethod("author", "SpecificModels", function (x, prefd_mdl_types_chr = NULL, what_1L_chr = "all",
@@ -49,8 +50,8 @@ methods::setMethod("author", "SpecificModels", function (x, prefd_mdl_types_chr
4950
nbr_of_digits_1L_int = digits_1L_int, participation_var_1L_chr = x@a_YouthvarsProfile@participation_var_1L_chr)
5051
descv_plts_paths_ls <- youthvars::write_descv_plots(x@a_YouthvarsProfile@a_Ready4useDyad@ds_tb,
5152
ds_descvs_ls = ds_descvs_ls, descv_outp_dir_1L_chr = x@b_SpecificParameters@paths_ls$descv_outp_dir_1L_chr,
52-
lbl_nms_chr = x@b_SpecificParameters@domain_labels_chr,
53-
maui_domains_pfxs_1L_chr = x@b_SpecificParameters@itm_prefix_1L_chr)
53+
lbl_nms_chr = x@b_SpecificParameters@itm_labels_chr,
54+
maui_domains_pfxs_1L_chr = hutils::longest_prefix(C@b_SpecificParameters@domain_labels_chr))
5455
}
5556
if (what_1L_chr %in% c("models", "all")) {
5657
x <- investigate(x)

R/mthd_authorData.R

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@
99
#' @rdname authorData-methods
1010
#' @aliases authorData,SpecificMixed-method
1111
#' @export
12+
#' @importFrom purrr map
1213
#' @importFrom ready4 authorData
1314
methods::setMethod("authorData", "SpecificMixed", function (x, title_1L_chr = "An R model object", what_1L_chr = "Shareable")
1415
{
1516
if (what_1L_chr == "Shareable") {
16-
outp_smry_ls <- append(procureSlot(x, "c_SpecificResults@b_SpecificPrivate@private_outp_ls"),
17-
procureSlot(x, "c_SpecificResults@a_SpecificShareable@shareable_outp_ls"))
18-
outp_smry_ls <- outp_smry_ls %>% write_shareable_mdls(new_dir_nm_1L_chr = "G_Shareable",
19-
shareable_title_detail_1L_chr = title_1L_chr)
17+
results_ls <- purrr::map(manufacture(x@c_SpecificResults,
18+
what_1L_chr = "indexed_shareable"), ~{
19+
outp_smry_ls <- append(procureSlot(x, "c_SpecificResults@b_SpecificPrivate@private_outp_ls"),
20+
.x)
21+
outp_smry_ls <- outp_smry_ls %>% write_shareable_mdls(new_dir_nm_1L_chr = "G_Shareable",
22+
shareable_title_detail_1L_chr = title_1L_chr)
23+
outp_smry_ls[-1]
24+
})
2025
x <- renewSlot(x, "c_SpecificResults@a_SpecificShareable@shareable_outp_ls",
2126
outp_smry_ls[-1])
2227
}

R/mthd_enhance.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#' @name enhance-SpecificSynopsis
44
#' @description enhance method applied to SpecificSynopsis
55
#' @param x An object of class SpecificSynopsis
6-
#' @param y_SpecificMixed PARAM_DESCRIPTION
7-
#' @param z_Ready4useRepos PARAM_DESCRIPTION
86
#' @param depnt_var_nms_chr Dependent variable names (a character vector), Default: 'NA'
97
#' @param what_1L_chr What (a character vector of length one), Default: 'shareable_outp_ls'
108
#' @param with_1L_chr With (a character vector of length one), Default: 'results_ls'
@@ -13,8 +11,8 @@
1311
#' @aliases enhance,SpecificSynopsis-method
1412
#' @export
1513
#' @importFrom ready4 enhance
16-
methods::setMethod("enhance", "SpecificSynopsis", function (x, y_SpecificMixed, z_Ready4useRepos, depnt_var_nms_chr = NA_character_,
17-
what_1L_chr = "shareable_outp_ls", with_1L_chr = "results_ls")
14+
methods::setMethod("enhance", "SpecificSynopsis", function (x, depnt_var_nms_chr = NA_character_, what_1L_chr = "shareable_outp_ls",
15+
with_1L_chr = "results_ls")
1816
{
1917
if (what_1L_chr == "shareable_outp_ls") {
2018
outp_smry_ls <- x@b_SpecificResults@a_SpecificShareable@shareable_outp_ls

R/mthd_investigate.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ methods::setMethod("investigate", "SpecificModels", function (x, depnt_var_max_v
3939
#' @rdname investigate-methods
4040
#' @aliases investigate,SpecificMixed-method
4141
#' @export
42+
#' @importFrom stats setNames
4243
#' @importFrom purrr map
4344
#' @importFrom ready4 investigate
4445
methods::setMethod("investigate", "SpecificMixed", function (x, backend_1L_chr = "cmdstanr", new_dir_nm_1L_chr = "F_TS_Mdls",
@@ -74,14 +75,15 @@ methods::setMethod("investigate", "SpecificMixed", function (x, backend_1L_chr =
7475
input_params_ls <- manufacture(x, what_1L_chr = "input_params_ls")
7576
input_params_ls$rename_lup <- x@c_SpecificResults@a_SpecificShareable@shareable_outp_ls$rename_lup
7677
input_params_ls$scndry_anlys_params_ls <- scndry_anlys_params_ls
77-
input_params_ls$path_params_ls$paths_ls <- list(write_to_dir_nm_1L_chr = x@paths_chr)
78+
input_params_ls$path_params_ls$paths_ls <- list(write_to_dir_nm_1L_chr = x@c_SpecificResults@a_SpecificShareable@shareable_outp_ls$path_to_write_to_1L_chr)
7879
input_params_ls$outp_smry_ls <- append(x@c_SpecificResults@a_SpecificShareable@shareable_outp_ls,
7980
x@c_SpecificResults@b_SpecificPrivate@private_outp_ls)
8081
input_params_ls$params_ls$control_ls <- control_ls
8182
input_params_ls$params_ls$prior_ls <- prior_ls
8283
input_params_ls$params_ls$iters_1L_int <- x@b_SpecificParameters@iters_1L_int
8384
results_ls_ls <- write_secondary_analyses(input_params_ls,
84-
backend_1L_chr = backend_1L_chr, new_dir_nm_1L_chr = new_dir_nm_1L_chr)
85+
backend_1L_chr = backend_1L_chr, new_dir_nm_1L_chr = new_dir_nm_1L_chr) %>%
86+
stats::setNames(names(scndry_anlys_params_ls))
8587
x@c_SpecificResults@a_SpecificShareable@shareable_outp_ls <- append(x@c_SpecificResults@a_SpecificShareable@shareable_outp_ls,
8688
results_ls_ls %>% purrr::map(~.x[-1]))
8789
}

R/mthd_manufacture.R

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
11
#'
22
#' Manufacture a (non ready4 framework) object
3+
#' @name manufacture-SpecificResults
4+
#' @description manufacture method applied to SpecificResults
5+
#' @param x An object of class SpecificResults
6+
#' @param what_1L_chr What (a character vector of length one), Default: 'indexed_shareable'
7+
#' @return Object (an output object of multiple potential types)
8+
#' @rdname manufacture-methods
9+
#' @aliases manufacture,SpecificResults-method
10+
#' @export
11+
#' @importFrom purrr map
12+
#' @importFrom methods callNextMethod
13+
#' @importFrom ready4 manufacture
14+
methods::setMethod("manufacture", "SpecificResults", function (x, what_1L_chr = "indexed_shareable")
15+
{
16+
if (what_1L_chr == "indexed_shareable") {
17+
shareable_outp_ls <- procureSlot(x, "a_SpecificShareable@shareable_outp_ls")
18+
secondary_chr <- names(shareable_outp_ls)[startsWith(names(shareable_outp_ls),
19+
"secondary_")]
20+
if (!identical(secondary_chr, character(0))) {
21+
primary_ls <- shareable_outp_ls[names(shareable_outp_ls) !=
22+
secondary_chr]
23+
secondary_ls <- shareable_outp_ls[names(shareable_outp_ls) ==
24+
secondary_chr]
25+
object_xx <- append(list(primary_ls = primary_ls[(names(primary_ls))[!names(primary_ls) %>%
26+
duplicated()]]), secondary_ls %>% purrr::map(~.x[(.x %>%
27+
names())[!.x %>% names() %>% duplicated()]]))
28+
}
29+
else {
30+
object_xx <- list(primary_ls = primary_ls)
31+
}
32+
}
33+
else {
34+
object_xx <- methods::callNextMethod()
35+
}
36+
return(object_xx)
37+
})
38+
#'
39+
#' Manufacture a (non ready4 framework) object
340
#' @name manufacture-SpecificProject
441
#' @description manufacture method applied to SpecificProject
542
#' @param x An object of class SpecificProject

R/mthd_metamorphose.R

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,10 @@ methods::setMethod("metamorphose", "SpecificMixed", function (x, to_1L_chr = "Sp
3838
#' @rdname metamorphose-methods
3939
#' @aliases metamorphose,SpecificConverter-method
4040
#' @export
41-
#' @importFrom purrr map_chr
42-
#' @importFrom ready4 get_from_lup_obj metamorphose
43-
#' @importFrom stringi stri_replace_first_fixed stri_replace_all_fixed stri_replace_last_fixed
41+
#' @importFrom ready4 metamorphose
4442
methods::setMethod("metamorphose", "SpecificConverter", function (x, paths_chr = NA_character_)
4543
{
46-
domain_labels_chr <- x@a_ScorzProfile@domain_wtd_var_nms_chr %>%
47-
purrr::map_chr(~ready4::get_from_lup_obj(x@a_ScorzProfile@instrument_dict_r3,
48-
match_var_nm_1L_chr = "var_nm_chr", match_value_xx = .x,
49-
target_var_nm_1L_chr = "var_desc_chr") %>% stringi::stri_replace_first_fixed("EuroQol (EQ-5D) - ",
50-
"") %>% stringi::stri_replace_all_fixed("Adult Score Dimension 1 - ",
51-
"") %>% stringi::stri_replace_last_fixed(" item",
52-
""))
44+
domain_labels_chr <- x@a_ScorzProfile@domain_wtd_var_nms_chr
5345
x_SpecificModels <- SpecificModels(a_YouthvarsProfile = procureSlot(x@a_ScorzProfile,
5446
"a_YouthvarsProfile"), b_SpecificParameters = SpecificParameters(depnt_var_nm_1L_chr = x@a_ScorzProfile@total_wtd_var_nm_1L_chr,
5547
domain_labels_chr = domain_labels_chr, itm_labels_chr = x@a_ScorzProfile@itm_labels_chr,

_pkgdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ reference:
143143
- investigate-SpecificModels
144144
- investigate-SpecificPredictors
145145
- manufacture-SpecificProject
146+
- manufacture-SpecificResults
146147
- manufacture-SpecificSynopsis
147148
- metamorphose-SpecificConverter
148149
- metamorphose-SpecificMixed

0 commit comments

Comments
 (0)