Skip to content

Commit

Permalink
bug fixes in renew and author methods
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewphamilton committed Jun 26, 2023
1 parent 2d1e2db commit 0e18e8b
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 18 deletions.
10 changes: 7 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ Imports:
VignetteBuilder: knitr
Depends:
R (>= 2.10),
specific
scorz (>= 0.0.0.9059),
specific (>= 0.0.0.9102)
LazyData: true
Collate:
'C4_TTUSynopsis.R'
Expand All @@ -66,9 +67,12 @@ Suggests:
betareg,
caret,
knitrBootstrap,
rmarkdown
rmarkdown,
youthvars (>= 0.0.0.9121)
Remotes:
ready4-dev/ready4,
ready4-dev/ready4show,
ready4-dev/ready4use,
ready4-dev/specific
ready4-dev/specific,
ready4-dev/youthvars,
ready4-dev/scorz
20 changes: 17 additions & 3 deletions R/mthd_author.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,13 @@ methods::setMethod("author", "TTUReports", function (x, args_ls = NULL, consent_
#' @description author method applied to TTUProject
#' @param x An object of class TTUProject
#' @param consent_1L_chr Consent (a character vector of length one), Default: ''
#' @param custom_args_ls Custom arguments (a list), Default: NULL
#' @param custom_fn Custom (a function), Default: NULL
#' @param depnt_var_min_val_1L_dbl Dependent variable minimum value (a double vector of length one), Default: numeric(0)
#' @param digits_1L_int Digits (an integer vector of length one), Default: 2
#' @param download_tmpl_1L_lgl Download template (a logical vector of length one), Default: T
#' @param fl_nm_1L_chr File name (a character vector of length one), Default: 'TTUProject'
#' @param items_as_domains_1L_lgl Items as domains (a logical vector of length one), Default: F
#' @param supplement_fl_nm_1L_chr Supplement file name (a character vector of length one), Default: 'TA_PDF'
#' @param timepoint_new_nms_chr Timepoint new names (a character vector), Default: 'NA'
#' @param type_1L_chr Type (a character vector of length one), Default: 'auto'
Expand All @@ -150,8 +153,9 @@ methods::setMethod("author", "TTUReports", function (x, args_ls = NULL, consent_
#' @importFrom R.utils copyDirectory
#' @importFrom ready4show make_rmd_fl_nms_ls
#' @importFrom methods callNextMethod
methods::setMethod("author", "TTUProject", function (x, consent_1L_chr = "", depnt_var_min_val_1L_dbl = numeric(0),
digits_1L_int = 2L, download_tmpl_1L_lgl = T, fl_nm_1L_chr = "TTUProject",
methods::setMethod("author", "TTUProject", function (x, consent_1L_chr = "", custom_args_ls = NULL, custom_fn = NULL,
depnt_var_min_val_1L_dbl = numeric(0), digits_1L_int = 2L,
download_tmpl_1L_lgl = T, fl_nm_1L_chr = "TTUProject", items_as_domains_1L_lgl = F,
supplement_fl_nm_1L_chr = "TA_PDF", timepoint_new_nms_chr = NA_character_,
type_1L_chr = "auto", what_1L_chr = "default", ...)
{
Expand All @@ -175,9 +179,19 @@ methods::setMethod("author", "TTUProject", function (x, consent_1L_chr = "", dep
what_1L_chr = Hmisc::capitalize(what_1L_chr))
}
if (what_1L_chr %in% c("descriptives", "Descriptives")) {
if (items_as_domains_1L_lgl == T) {
x_labels_chr <- manufacture(x@a_ScorzProfile,
what_1L_chr = "domains", custom_args_ls = list(string = x@b_SpecificParameters@itm_labels_chr),
custom_fn = Hmisc::capitalize)
}
else {
x_labels_chr <- manufacture(x@a_ScorzProfile,
what_1L_chr = "domains")
}
x <- renewSlot(x, "c_SpecificProject", authorSlot(x,
"c_SpecificProject", consent_1L_chr = consent_1L_chr,
digits_1L_int = digits_1L_int, what_1L_chr = tolower(what_1L_chr)))
digits_1L_int = digits_1L_int, what_1L_chr = tolower(what_1L_chr),
x_labels_chr = x_labels_chr))
}
if (what_1L_chr %in% c("manuscript", "Manuscript")) {
if (type_1L_chr == "auto") {
Expand Down
7 changes: 2 additions & 5 deletions R/mthd_renew.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ methods::setMethod("renew", "TTUProject", function (x, new_val_xx = NULL, consen
}
if (type_1L_chr == "predictors_lup") {
if (new_val_xx == "use_renew_mthd") {
predictors_lup <- Ready4useRepos(dv_nm_1L_chr = "TTU",
dv_ds_nm_1L_chr = "https://doi.org/10.7910/DVN/DKDIB0",
dv_server_1L_chr = "dataverse.harvard.edu") %>%
ingest(fls_to_ingest_chr = c(fl_nm_1L_chr),
metadata_1L_lgl = F)
predictors_lup <- y_Ready4useRepos %>% ingest(fls_to_ingest_chr = c(fl_nm_1L_chr),
metadata_1L_lgl = F)
}
else {
predictors_lup <- new_val_xx
Expand Down
4 changes: 2 additions & 2 deletions data-raw/DATASET.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ x <- ready4fun::make_pkg_desc_ls(pkg_title_1L_chr = "Implement Transfer to Utili
This development version of the TTU package has been made available as part of the process of testing and documenting the package.
If you have any questions, please contact the authors ([email protected]).",
authors_prsn = c(utils::person(given = "Caroline",family = "Gao",email = "[email protected]", role = c("aut"),comment = c(ORCID = "0000-0002-0987-2759")),
utils::person(given = "Matthew",family = "Hamilton",email = "matthew.[email protected]", role = c("aut", "cre"),comment = c(ORCID = "0000-0001-7407-9194")),
utils::person(given = "Matthew",family = "Hamilton",email = "matthew.[email protected]", role = c("aut", "cre", "fnd"),comment = c(ORCID = "0000-0001-7407-9194")),
utils::person("Orygen", role = c("cph", "fnd")),
utils::person("Headspace", role = c( "fnd")),
utils::person("National Health and Medical Research Council", role = c( "fnd"))),
Expand Down Expand Up @@ -211,4 +211,4 @@ devtools::build_vignettes()
# tag = paste0("v",desc::desc_get_version()),
# body = "Version implemented following significant redevelopment of package dependencies.",
# prerelease = F)
# devtools::build_vignettes()

12 changes: 11 additions & 1 deletion data-raw/s4_fns/author.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,13 @@ author_TTUReports <- function(x,
}
author_TTUProject <- function(x,
consent_1L_chr = "",
custom_args_ls = NULL,
custom_fn = NULL,
depnt_var_min_val_1L_dbl = numeric(0),
digits_1L_int = 2L,
download_tmpl_1L_lgl = T,
fl_nm_1L_chr = "TTUProject",
items_as_domains_1L_lgl = F,
supplement_fl_nm_1L_chr = "TA_PDF",
timepoint_new_nms_chr = NA_character_,
type_1L_chr = "auto",
Expand Down Expand Up @@ -183,11 +186,18 @@ author_TTUProject <- function(x,
authorSlot(x, "d_TTUReports", consent_1L_chr = consent_1L_chr, download_tmpl_1L_lgl = download_tmpl_1L_lgl, what_1L_chr = Hmisc::capitalize(what_1L_chr))
}
if(what_1L_chr %in% c("descriptives","Descriptives")){
if(items_as_domains_1L_lgl == T){
x_labels_chr <- manufacture(x@a_ScorzProfile, what_1L_chr = "domains",
custom_args_ls = list(string = x@b_SpecificParameters@itm_labels_chr), custom_fn = Hmisc::capitalize)
}else{
x_labels_chr <- manufacture(x@a_ScorzProfile, what_1L_chr = "domains")
}
x <- renewSlot(x, "c_SpecificProject",
authorSlot(x, "c_SpecificProject",
consent_1L_chr = consent_1L_chr,
digits_1L_int = digits_1L_int,
what_1L_chr = tolower(what_1L_chr)))
what_1L_chr = tolower(what_1L_chr),
x_labels_chr = x_labels_chr))
}
if(what_1L_chr %in% c("manuscript", "Manuscript")){
if(type_1L_chr=="auto"){
Expand Down
2 changes: 1 addition & 1 deletion data-raw/s4_fns/renew.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ renew_TTUProject <- function(x,
}
if(type_1L_chr=="predictors_lup"){
if(new_val_xx == "use_renew_mthd"){
predictors_lup <- Ready4useRepos(dv_nm_1L_chr = "TTU", dv_ds_nm_1L_chr = "https://doi.org/10.7910/DVN/DKDIB0", dv_server_1L_chr = "dataverse.harvard.edu") %>%
predictors_lup <- y_Ready4useRepos %>%
ingest(fls_to_ingest_chr = c(fl_nm_1L_chr), metadata_1L_lgl = F)
}else{
predictors_lup <- new_val_xx
Expand Down
4 changes: 2 additions & 2 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ citEntry(
entry = "Manual",
doi = "10.5281/zenodo.5646593",
title = paste0(meta$Package,": ",meta$Title),
author = c(person("Caroline Gao <[email protected]> [aut]", "(<https://orcid.org/0000-0002-0987-2759>)"), person("Matthew Hamilton <matthew.[email protected]> [aut, cre]", "(<https://orcid.org/0000-0001-7407-9194>)")),
author = c(person("Caroline Gao <[email protected]> [aut]", "(<https://orcid.org/0000-0002-0987-2759>)"), person("Matthew Hamilton <matthew.[email protected]> [aut, cre, fnd]", "(<https://orcid.org/0000-0001-7407-9194>)")),
year = "2023",
note = sprintf("R package version %s", meta$Version),
url = "https://ready4-dev.github.io/TTU/",
textVersion = paste("Caroline Gao <[email protected]> [aut] (<https://orcid.org/0000-0002-0987-2759>), Matthew Hamilton <matthew.[email protected]> [aut and cre] (<https://orcid.org/0000-0001-7407-9194>) ",
textVersion = paste("Caroline Gao <[email protected]> [aut] (<https://orcid.org/0000-0002-0987-2759>), Matthew Hamilton <matthew.[email protected]> [aut, cre and fnd] (<https://orcid.org/0000-0001-7407-9194>) ",
"(2023).",
paste0(meta$Package,": ",meta$Title,
"."),
Expand Down
2 changes: 1 addition & 1 deletion man/TTU-package.Rd

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

9 changes: 9 additions & 0 deletions man/author-methods.Rd

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

0 comments on commit 0e18e8b

Please sign in to comment.