Skip to content

Commit

Permalink
added DYAD cls and depict mthd
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewphamilton committed Nov 16, 2021
1 parent 68dc4dc commit e3ce9b3
Show file tree
Hide file tree
Showing 48 changed files with 284 additions and 75 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@
^data-raw/test_s4_fns/procure\.R$
^data-raw/TEST_s4_fns/manufacture\.R$
^data-raw/TEST_s4_fns/procure\.R$
^data-raw/s4_fns/print\.R$
^data-raw/s4_fns/depict\.R$
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export("%>%")
export(Ready4useArguments)
export(Ready4useDyad)
export(Ready4useFiles)
export(Ready4useProcessed)
export(Ready4useRaw)
Expand Down Expand Up @@ -62,10 +63,13 @@ export(write_fls_to_dv_ds)
export(write_paired_ds_fls_to_dv)
export(write_to_copy_fls_to_dv_dir)
exportClasses(Ready4useArguments)
exportClasses(Ready4useDyad)
exportClasses(Ready4useFiles)
exportClasses(Ready4useProcessed)
exportClasses(Ready4useRaw)
exportMethods(depict)
import(methods)
import(ready4)
importFrom(Hmisc,label)
importFrom(assertthat,are_equal)
importFrom(data.table,fread)
Expand Down Expand Up @@ -103,6 +107,7 @@ importFrom(purrr,reduce)
importFrom(purrr,walk)
importFrom(readxl,read_excel)
importFrom(ready4,add_lups)
importFrom(ready4,depict)
importFrom(ready4,get_rds_from_dv)
importFrom(ready4,make_files_tb)
importFrom(ready4,make_local_path_to_dv_data)
Expand All @@ -117,6 +122,7 @@ importFrom(ready4,write_fls_from_dv)
importFrom(ready4,write_fls_to_dv)
importFrom(ready4,write_to_dv_from_tbl)
importFrom(ready4,write_to_dv_with_wait)
importFrom(ready4show,print_table)
importFrom(rlang,exec)
importFrom(rlang,sym)
importFrom(stats,setNames)
Expand Down
10 changes: 5 additions & 5 deletions R/C3_ready4use_dataverses.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ setOldClass(c("ready4use_dataverses","tbl_df", "tbl", "data.frame"))
#' @description Create a new valid instance of the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @param x A prototype for the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse., Default: make_pt_ready4use_dataverses()
#' @return A validated instance of the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details Tibble object lookup table of files to be imported from a dataverse.
#' @rdname ready4use_dataverses
#' @export
ready4use_dataverses <- function(x = make_pt_ready4use_dataverses()){
Expand All @@ -14,7 +14,7 @@ validate_ready4use_dataverses(make_new_ready4use_dataverses(x))
#' @description Create a new unvalidated instance of the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @param x A prototype for the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @return An unvalidated instance of the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details Tibble object lookup table of files to be imported from a dataverse.
#' @rdname make_new_ready4use_dataverses
#' @export
#' @importFrom tibble is_tibble
Expand All @@ -34,7 +34,7 @@ x
#' @param data_repo_file_ext_chr Data repository file extension (a character vector), Default: character(0)
#' @param data_repo_save_type_chr Data repository save type (a character vector), Default: character(0)
#' @return A prototype for ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details Tibble object lookup table of files to be imported from a dataverse.
#' @rdname make_pt_ready4use_dataverses
#' @export
#' @importFrom ready4 update_pt_fn_args_ls
Expand All @@ -60,7 +60,7 @@ rlang::exec(tibble::tibble,!!!args_ls)
#' @description Validate an instance of the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @param x An unvalidated instance of the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @return A prototpe for ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details Tibble object lookup table of files to be imported from a dataverse.
#' @rdname validate_ready4use_dataverses
#' @export
#' @importFrom stringr str_detect str_c
Expand Down Expand Up @@ -108,7 +108,7 @@ x}
#' @description Check whether an object is a valid instance of the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @param x An object of any type
#' @return A logical value, TRUE if a valid instance of the ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details ready4 S3 class for tibble object lookup table of files to be imported from a dataverse.
#' @details Tibble object lookup table of files to be imported from a dataverse.
#' @rdname is_ready4use_dataverses
#' @export
is_ready4use_dataverses <- function(x) inherits(validate_ready4use_dataverses(x), "ready4use_dataverses")
10 changes: 5 additions & 5 deletions R/C3_ready4use_dictionary.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ setOldClass(c("ready4use_dictionary","tbl_df", "tbl", "data.frame"))
#' @description Create a new valid instance of the ready4 s3 class defining a data dictionary tibble.
#' @param x A prototype for the ready4 s3 class defining a data dictionary tibble., Default: make_pt_ready4use_dictionary()
#' @return A validated instance of the ready4 s3 class defining a data dictionary tibble.
#' @details ready4 s3 class defining a data dictionary tibble.
#' @details A data dictionary tibble.
#' @rdname ready4use_dictionary
#' @export
ready4use_dictionary <- function(x = make_pt_ready4use_dictionary()){
Expand All @@ -14,7 +14,7 @@ validate_ready4use_dictionary(make_new_ready4use_dictionary(x))
#' @description Create a new unvalidated instance of the ready4 s3 class defining a data dictionary tibble.
#' @param x A prototype for the ready4 s3 class defining a data dictionary tibble.
#' @return An unvalidated instance of the ready4 s3 class defining a data dictionary tibble.
#' @details ready4 s3 class defining a data dictionary tibble.
#' @details A data dictionary tibble.
#' @rdname make_new_ready4use_dictionary
#' @export
#' @importFrom tibble is_tibble
Expand All @@ -31,7 +31,7 @@ x
#' @param var_desc_chr Variable description (a character vector), Default: character(0)
#' @param var_type_chr Variable type (a character vector), Default: character(0)
#' @return A prototype for ready4 s3 class defining a data dictionary tibble.
#' @details ready4 s3 class defining a data dictionary tibble.
#' @details A data dictionary tibble.
#' @rdname make_pt_ready4use_dictionary
#' @export
#' @importFrom ready4 update_pt_fn_args_ls
Expand All @@ -51,7 +51,7 @@ rlang::exec(tibble::tibble,!!!args_ls)
#' @description Validate an instance of the ready4 s3 class defining a data dictionary tibble.
#' @param x An unvalidated instance of the ready4 s3 class defining a data dictionary tibble.
#' @return A prototpe for ready4 s3 class defining a data dictionary tibble.
#' @details ready4 s3 class defining a data dictionary tibble.
#' @details A data dictionary tibble.
#' @rdname validate_ready4use_dictionary
#' @export
#' @importFrom stringr str_detect str_c
Expand Down Expand Up @@ -99,7 +99,7 @@ x}
#' @description Check whether an object is a valid instance of the ready4 s3 class defining a data dictionary tibble.
#' @param x An object of any type
#' @return A logical value, TRUE if a valid instance of the ready4 s3 class defining a data dictionary tibble.
#' @details ready4 s3 class defining a data dictionary tibble.
#' @details A data dictionary tibble.
#' @rdname is_ready4use_dictionary
#' @export
is_ready4use_dictionary <- function(x) inherits(validate_ready4use_dictionary(x), "ready4use_dictionary")
10 changes: 5 additions & 5 deletions R/C3_ready4use_distributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @description Create a new valid instance of the ready4 S3 class for list object that summarises the parameters of each distribution
#' @param x A prototype for the ready4 S3 class for list object that summarises the parameters of each distribution, Default: make_pt_ready4use_distributions()
#' @return A validated instance of the ready4 S3 class for list object that summarises the parameters of each distribution
#' @details ready4 S3 class for list object that summarises the parameters of each distribution
#' @details List object that summarises the parameters of each distribution
#' @rdname ready4use_distributions
#' @export
ready4use_distributions <- function(x = make_pt_ready4use_distributions()){
Expand All @@ -13,7 +13,7 @@ validate_ready4use_distributions(make_new_ready4use_distributions(x))
#' @description Create a new unvalidated instance of the ready4 S3 class for list object that summarises the parameters of each distribution
#' @param x A prototype for the ready4 S3 class for list object that summarises the parameters of each distribution
#' @return An unvalidated instance of the ready4 S3 class for list object that summarises the parameters of each distribution
#' @details ready4 S3 class for list object that summarises the parameters of each distribution
#' @details List object that summarises the parameters of each distribution
#' @rdname make_new_ready4use_distributions
#' @export
make_new_ready4use_distributions <- function(x){
Expand All @@ -31,7 +31,7 @@ x
#' @param dstr_param_4_dbl Distribution parameter 4 (a double vector), Default: numeric(0)
#' @param transformation_chr Transformation (a character vector), Default: character(0)
#' @return A prototype for ready4 S3 class for list object that summarises the parameters of each distribution
#' @details ready4 S3 class for list object that summarises the parameters of each distribution
#' @details List object that summarises the parameters of each distribution
#' @rdname make_pt_ready4use_distributions
#' @export
#' @importFrom ready4 update_pt_fn_args_ls
Expand All @@ -54,7 +54,7 @@ rlang::exec(list,!!!args_ls)
#' @description Validate an instance of the ready4 S3 class for list object that summarises the parameters of each distribution
#' @param x An unvalidated instance of the ready4 S3 class for list object that summarises the parameters of each distribution
#' @return A prototpe for ready4 S3 class for list object that summarises the parameters of each distribution
#' @details ready4 S3 class for list object that summarises the parameters of each distribution
#' @details List object that summarises the parameters of each distribution
#' @rdname validate_ready4use_distributions
#' @export
#' @importFrom stringr str_detect str_c
Expand Down Expand Up @@ -104,7 +104,7 @@ x}
#' @description Check whether an object is a valid instance of the ready4 S3 class for list object that summarises the parameters of each distribution
#' @param x An object of any type
#' @return A logical value, TRUE if a valid instance of the ready4 S3 class for list object that summarises the parameters of each distribution
#' @details ready4 S3 class for list object that summarises the parameters of each distribution
#' @details List object that summarises the parameters of each distribution
#' @rdname is_ready4use_distributions
#' @export
is_ready4use_distributions <- function(x) inherits(validate_ready4use_distributions(x), "ready4use_distributions")
10 changes: 5 additions & 5 deletions R/C3_ready4use_imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ setOldClass(c("ready4use_imports","tbl_df", "tbl", "data.frame"))
#' @description Create a new valid instance of the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @param x A prototype for the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import., Default: make_pt_ready4use_imports()
#' @return A validated instance of the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details Tibble object lookup table of sources of raw (un-processed) data to import.
#' @rdname ready4use_imports
#' @export
ready4use_imports <- function(x = make_pt_ready4use_imports()){
Expand All @@ -15,7 +15,7 @@ validate_ready4use_imports(make_new_ready4use_imports(x))
#' @description Create a new unvalidated instance of the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @param x A prototype for the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @return An unvalidated instance of the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details Tibble object lookup table of sources of raw (un-processed) data to import.
#' @rdname make_new_ready4use_imports
#' @export
#' @importFrom tibble is_tibble
Expand All @@ -41,7 +41,7 @@ x
#' @param inc_fls_to_rename_ls Include files to rename (a list), Default: list()
#' @param new_nms_for_inc_fls_ls New names for include files (a list), Default: list()
#' @return A prototype for ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details Tibble object lookup table of sources of raw (un-processed) data to import.
#' @rdname make_pt_ready4use_imports
#' @export
#' @importFrom ready4 update_pt_fn_args_ls
Expand Down Expand Up @@ -79,7 +79,7 @@ rlang::exec(tibble::tibble,!!!args_ls)
#' @description Validate an instance of the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @param x An unvalidated instance of the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @return A prototpe for ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details Tibble object lookup table of sources of raw (un-processed) data to import.
#' @rdname validate_ready4use_imports
#' @export
#' @importFrom stringr str_detect str_c
Expand Down Expand Up @@ -127,7 +127,7 @@ x}
#' @description Check whether an object is a valid instance of the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @param x An object of any type
#' @return A logical value, TRUE if a valid instance of the ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details ready4 S3 class for tibble object lookup table of sources of raw (un-processed) data to import.
#' @details Tibble object lookup table of sources of raw (un-processed) data to import.
#' @rdname is_ready4use_imports
#' @export
is_ready4use_imports <- function(x) inherits(validate_ready4use_imports(x), "ready4use_imports")
10 changes: 5 additions & 5 deletions R/C3_ready4use_mapes.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ setOldClass(c("ready4use_mapes","tbl_df", "tbl", "data.frame"))
#' @description Create a new valid instance of the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @param x A prototype for the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors., Default: make_pt_ready4use_mapes()
#' @return A validated instance of the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details Tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @rdname ready4use_mapes
#' @export
ready4use_mapes <- function(x = make_pt_ready4use_mapes()){
Expand All @@ -14,7 +14,7 @@ validate_ready4use_mapes(make_new_ready4use_mapes(x))
#' @description Create a new unvalidated instance of the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @param x A prototype for the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @return An unvalidated instance of the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details Tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @rdname make_new_ready4use_mapes
#' @export
#' @importFrom tibble is_tibble
Expand All @@ -41,7 +41,7 @@ x
#' @param mape_10_yr_shp_dbl Mean absolute prediction error 10 year shape (a double vector), Default: numeric(0)
#' @param mape_15_yr_shp_dbl Mean absolute prediction error 15 year shape (a double vector), Default: numeric(0)
#' @return A prototype for ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details Tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @rdname make_pt_ready4use_mapes
#' @export
#' @importFrom ready4 update_pt_fn_args_ls
Expand Down Expand Up @@ -81,7 +81,7 @@ rlang::exec(tibble::tibble,!!!args_ls)
#' @description Validate an instance of the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @param x An unvalidated instance of the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @return A prototpe for ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details Tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @rdname validate_ready4use_mapes
#' @export
#' @importFrom stringr str_detect str_c
Expand Down Expand Up @@ -129,7 +129,7 @@ x}
#' @description Check whether an object is a valid instance of the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @param x An object of any type
#' @return A logical value, TRUE if a valid instance of the ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details ready4 S3 class for tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @details Tibble object that stores simulation structural parameters relating to Mean Absolute Prediction Errors.
#' @rdname is_ready4use_mapes
#' @export
is_ready4use_mapes <- function(x) inherits(validate_ready4use_mapes(x), "ready4use_mapes")
2 changes: 1 addition & 1 deletion R/C4_Ready4useArguments.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Ready4useArguments
#'
#' ready4 S4 class containing data to be passed to a function that constructs a spatial object from a lookup table.
#' Arguments for a function that constructs a spatial object.
#'
#' @include C4_Ready4useProcessed.R
#' @slot crs_nbr_dbl Crs number (a double vector)
Expand Down
23 changes: 23 additions & 0 deletions R/C4_Ready4useDyad.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#' Ready4useDyad
#'
#' A dataset and data dictionary pair.
#'
setOldClass(c("ready4use_dictionary","tbl_df", "tbl", "data.frame"))
#' @slot ds_tb Dataset (a tibble)
#' @slot dictionary_r3 Dictionary (a ready4 S3)
#' @import ready4
#' @name Ready4useDyad-class
#' @rdname Ready4useDyad-class
#' @export Ready4useDyad
#' @exportClass Ready4useDyad
Ready4useDyad <- methods::setClass("Ready4useDyad",
contains = "Ready4Launch",
slots = c(ds_tb = "tbl_df",dictionary_r3 = "ready4use_dictionary"),
prototype = list(ds_tb = tibble::tibble(),dictionary_r3 = ready4use_dictionary()))


methods::setValidity(methods::className("Ready4useDyad"),
function(object){
msg <- NULL
if (is.null(msg)) TRUE else msg
})
Loading

0 comments on commit e3ce9b3

Please sign in to comment.