NEW GAME

library(ready4)
library(specific)
X <- ready4use::Ready4useRepos(gh_repo_1L_chr = "ready4-dev/specific", 
                          gh_tag_1L_chr = "Documentation_0.0") %>%
                         ingest(fls_to_ingest_chr = "eq5d_ttu_SpecificMixed",
                                metadata_1L_lgl = F)
# Fix for Shared X
## renewSlot
X@paths_chr <- X@c_SpecificResults@a_SpecificShareable@shareable_outp_ls$path_to_write_to_1L_chr
## ratify (conditional)
private_res_ls <- procureSlot(X,
                              "c_SpecificResults@b_SpecificPrivate@private_outp_ls")
if(identical(private_res_ls,
             list(list()))){
  private_res_ls <- list(scored_data_tb = X@a_YouthvarsProfile@a_Ready4useDyad@ds_tb)
  X <- renewSlot(X,
                 "c_SpecificResults@b_SpecificPrivate@private_outp_ls",
                 private_res_ls)
}
# X <- investigate(X,
#                  scndry_anlys_params_ls = make_scndry_anlys_params(candidate_predrs_chr = c("d_age"),
#                                                                    prefd_covars_chr = NA_character_))
X <- authorData(X) # Ammend to make shareable secondary analyses
X@c_SpecificResults@a_SpecificShareable@shareable_outp_ls$session_data_ls <- sessionInfo() # REMOVE

Specify metadata about the reports to be authored

Z <- metamorphose_SpecificMixed(X)
Z <- Z %>% # 
  renewSlot("authors_r3", ready4show::authors_tb) %>%
  renewSlot("coi_1L_chr", "None declared") %>%
  renewSlot("digits_int", c(3L,3L)) %>%
  renewSlot("ethics_1L_chr", 
            "The study was reviewed and granted approval by Awesome University's Human Research Ethics Committee (1111111.1).") %>%
  renewSlot("funding_1L_chr", "The study was funded by Generous Benefactor.") %>%
  renewSlot("institutes_r3", ready4show::institutes_tb) %>%
  renewSlot("interval_chr", "three months") %>%
  renewSlot("keywords_chr", c("entirely","fake","do", "not","cite")) %>%
  renewSlot("outp_formats_chr", c("PDF","PDF")) %>%
  renewSlot("sample_desc_1L_chr",
            "The study sample is fake data that pretends to be young people aged 12 to 25 years who attended Australian primary care services for mental health related needs between November 2019 to August 2020.") %>%
  renewSlot("title_1L_chr", "A hypothetical study using fake data") %>%
  renewSlot("correspondences_r3",
            old_nms_chr = c("PHQ9", "GAD7"),
            new_nms_chr = c("PHQ-9", "GAD-7")) %>%
  renewSlot("e_Ready4useRepos",
            ready4use::Ready4useRepos(dv_nm_1L_chr = "fakes",
                               dv_ds_nm_1L_chr = "https://doi.org/10.7910/DVN/GW7ZKC"))
Z <- enhance_SpecificSynopsis(Z,
             depnt_var_nms_chr = c("EQ5D",
                                   "EuroQol Five Dimension"), 
             with_1L_chr = "results_ls")

Report

authorData(Z,
           tmpl_url_1L_chr = "https://github.com/ready4-dev/ttu_mdl_ctlg",
           tmpl_version_1_L_chr = "0.0.9.3",
           what_1L_chr = "Catalogue")
authorReport(Z, # Modify for Secondary Analysis
             fl_nm_1L_chr = "AAA_TTU_MDL_CTG",
             what_1L_chr = "Catalogue")
Z <- renewSlot(Z,
               "rmd_fl_nms_ls",
               ready4show::make_rmd_fl_nms_ls(pdf_fl_nm_1L_chr = "Springer_PDF",
                                                  word_fl_nm_1L_chr = "Main_Word"))
authorData(Z,
           tmpl_url_1L_chr = "https://github.com/ready4-dev/ttu_lng_ss",
           tmpl_version_1_L_chr = "0.6")
#A <- 
composite_plt <- depict_SpecificSynopsis(Z,
                                          depnt_var_desc_1L_chr = "EQ5D",
                                          timepoint_old_nms_chr = X@a_YouthvarsProfile@timepoint_vals_chr,
                                          timepoint_new_nms_chr = c("Baseline","Follow-up"),
                                          write_1L_lgl = T)
composite_plt <- depict_SpecificSynopsis(Z,
                                          depnt_var_desc_1L_chr = "EQ5D",
                                          timepoint_old_nms_chr = X@a_YouthvarsProfile@timepoint_vals_chr,
                                          timepoint_new_nms_chr = c("Baseline","Follow-up"),
                                          write_1L_lgl = T)
# print_corls_tbl
# make_dnsty_and_sctr_plt_title
# results_ls$cohort_ls$n_inc_1L_dbl
# ds_descvs_ls$nbr_obs_in_raw_ds_1L_dbl <- nrow(data_tb)
# ds_descvs_ls$nbr_participants_1L_int <- length(data_tb %>% 
#                                                  dplyr::pull(ds_descvs_ls$id_var_nm_1L_chr) %>%
#                                                  unique())

# Need to update template RMDs
authorReport(Z)

PURGE DS

WIP


XXXXX

input_params_ls <- write_mdl_smry_rprt(input_params_ls,
                                       use_shareable_mdls_1L_lgl = T)

Share

X <- renew_SpecificMixed(X,
                         a_Ready4useRepos = A)
outp_smry_ls$

Note: This vignette uses fake data - it is for illustrative purposes only and should not be used to inform decision making.

library(ready4)
library(ready4show)
library(ready4use)
library(scorz)
library(specific)

Import data

We start by ingesting our data. As this example uses EQ-5D data, we import a ScorzEuroQol5 module (created using the steps described in this vignette from the scorz pacakge) into a SpecificConverter Module.

X <- SpecificConverter(a_ScorzProfile = ready4use::Ready4useRepos(gh_repo_1L_chr = "ready4-dev/scorz", 
                                                 gh_tag_1L_chr = "Documentation_0.0") %>%
                         ingest(fls_to_ingest_chr = "ymh_ScorzEuroQol5",
                                metadata_1L_lgl = F))
# X <- renewSlot(X,
#                "instrument_short_nm_1L_chr",
#                "EQ-5D")
# X@itm_prefix_1L_chr
# X@instrument_nm_1L_chr
Y <- metamorphose(X,
                  paths_chr = tempdir())

Specify parameters

In preparation for exploring our dataset, we need to declare a set of model parameters in a SpecificParameters object.

Y <- renewSlot(Y,
               "b_SpecificParameters",
               procureSlot(Y,
                           "b_SpecificParameters") %>%
                 renewSlot("depnt_var_min_max_dbl",
                           c(-1,1)) %>% ## Check min/max
                 renewSlot("candidate_predrs_chr",
                           c("K10_int","Psych_well_int")) %>%
                 renewSlot("candidate_covars_chr",
                           c("d_sex_birth_s", "d_age",  "d_sexual_ori_s", "d_studying_working")) %>%
                 renewSlot("candidate_mdls_lup",
                           get_cndt_mdls(mdl_short_nms_chr = c("OLS_NTF","OLS_CLL","GLM_GSN_LOG"))) %>%
                 renewSlot("descv_var_nms_chr",
                           c("d_age","Gender","d_relation_s",
                                                               "d_sexual_ori_s", "Region",
                                                               "d_studying_working")) %>% 
                 renewSlot("control_ls",
                           list(adapt_delta = 0.99)) %>%
                 renewSlot("fake_1L_lgl",
                           T) %>%
                 renewSlot("folds_1L_int",
                           10L) %>%
                 renewSlot("max_mdl_runs_1L_int",
                           300L) %>%
                  renewSlot("msrmnt_date_var_nm_1L_chr",
                           "data_collection_dtm") %>%
                 renewSlot("seed_1L_int",
                           1234L)) 
Y <- renewSlot(Y, 
               "b_SpecificParameters@predictors_lup", 
               short_name_chr = procureSlot(Y,
                                            "b_SpecificParameters@candidate_predrs_chr"),
               long_name_chr = c("Kessler Psychological Distress - 10 Item Total Score",
                                 "Overall Wellbeing Measure (Winefield et al. 2012)"),
               min_val_dbl = c(10,18),
               max_val_dbl = c(50,90),
               class_chr = "integer",
               increment_dbl = 1,
               class_fn_chr = "as.integer",
               mdl_scaling_dbl = 0.01,
               covariate_lgl = F)
# Y <- renew(Y,
#            c("OLS_CLL","GLM_GSN_LOG"),
#            what_1L_chr = "prefd_mdls")
# Y <- renew(Y,
#            NA_character_,
#            what_1L_chr = "prefd_covars")
# set.seed(procureSlot(Y,
#                      "b_SpecificParameters@seed_1L_int"))
session_data_ls <- sessionInfo() # Add to results?
Y <- ratify(Y)
Y <- author(Y,
            what_1L_chr = "workspace")

SAVE COPY OF INPUT DATA (WRITE_INPUTS_FOR_MAIN ANALYSIS) ???

## TRANSFORMATION FN HAD BEEN HERE
## DONT DELETE - NEEDED FOR REAL DATA
Y <- author(Y,
            what_1L_chr = "descriptives",
            digits_1L_int = Z@digits_int[1])
outp_smry_ls <- X@c_SpecificResults@a_SpecificShareable@shareable_outp_ls
saveRDS(outp_smry_ls, 
        paste0(outp_smry_ls$path_to_write_to_1L_chr, "/I_ALL_OUTPUT_.RDS"))
# write_analyses(input_params_ls) # Secondary analyses component
# Y <- ready4use::Ready4useRepos(gh_repo_1L_chr = "ready4-dev/scorz", 
#                                                                   gh_tag_1L_chr = "Documentation_0.0") %>%
#                          ingest(fls_to_ingest_chr = "ymh_ScorzEuroQol5",
#                                 metadata_1L_lgl = F)


ready4-dev/specific documentation built on Oct. 13, 2023, 7:54 a.m.