Skip to content

Commit

Permalink
tags dropped
Browse files Browse the repository at this point in the history
  • Loading branch information
bcjaeger committed Oct 21, 2023
1 parent a2d490f commit d476280
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 70 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Description: Fit, interpret, and make predictions with oblique random survival f
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE, roclets = c ("namespace", "rd", "srr::srr_stats_roclet"))
Roxygen: list(markdown = TRUE, roclets = c ("namespace", "rd"))
RoxygenNote: 7.2.3
LinkingTo:
Rcpp,
Expand Down
24 changes: 0 additions & 24 deletions R/check.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@


#' @srrstats {G1.4a} internal functions are documented with roxygen and given @noRd tags.

#' @srrstats {G5.2a} *messages produced here (e.g., with `stop()`, `warning()`, `message()`) are unique and make effort to highlight the specific data elements that cause the error*

#' strict checks for inputs
#'
#' @param arg_value the object that is to be checked
Expand Down Expand Up @@ -84,11 +80,6 @@ check_arg_uni <- function(uni, arg_name, expected_uni){

#' strict checks for inputs
#'
#' @srrstats {G2.0} *The function check_arg_length is used to vet inputs.*
#' @srrstats {G2.0a} *Error messages indicate expected lengths*
#'
#' @srrstats {G2.2} *prohibits submission of multivariate input to parameters expected to be univariate.*
#'
#' @param arg_value the object that is to be checked
#' @param arg_name the name of the object (used for possible error message)
#' @param expected_type what length should `arg_value` have?
Expand Down Expand Up @@ -265,7 +256,6 @@ check_arg_lteq <- function(arg_value, arg_name, bound, append_to_msg = NULL){

#' strict checks for inputs
#'
#' @srrstats {G2.3, G2.3a} *Using %in% instead of match.arg to allow customized error message when inputs are invalid.*
#' @param arg_value the object that is to be checked
#' @param arg_name the name of the object (used for possible error message)
#' @param valid_options what are the valid inputs for `arg_value`?
Expand Down Expand Up @@ -304,8 +294,6 @@ check_arg_is_valid <- function(arg_value, arg_name, valid_options) {
#'
#' make sure the user has supplied an integer valued input.
#'
#' @srrstats {G2.4a} *My design philosophy is that the user should be made aware if their input is the wrong type and the user should also be responsible for correcting the input. Therefore, this function communicates exactly what the user should do to fix the issue.*
#'
#' @param arg_value the object that is to be checked
#' @param arg_name the name of the object (used for possible error message)
#'
Expand Down Expand Up @@ -420,10 +408,6 @@ check_dots <- function(.dots, .f){

#' Check variable types
#'
#' @srrstats {G2.1} *types of variables in input data are vetted here.*
#'
#' @srrstats {G2.4} * I think the user should be aware of type inconsistencies in their data and the user should also take full responsibility for managing variable types. Therefore, this function communicates problems with variable types to the user but does not fix those problems for the user. It does tell the user exactly how to fix them.*
#'
#' orsf() should only be run with certain types of variables. This function
#' checks input data to make sure all variables have a primary (i.e., first)
#' class that is within the list of valid options.
Expand Down Expand Up @@ -643,8 +627,6 @@ check_orsf_inputs <- function(data = NULL,
call. = FALSE)
}

#' @srrstats {G2.9} issue diagnostic messages for blank column names. In this case, no fixes are applied. Instead, the user is notified by an error message.

# check for blanks first b/c the check for non-standard symbols
# will detect blanks with >1 empty characters

Expand Down Expand Up @@ -1363,10 +1345,6 @@ check_new_data_names <- function(new_data,

#' New data have same types as reference data
#'
#' @srrstats {G2.4} *I think the user should be aware of type inconsistencies in their data and the user should also take full responsibility for managing variable types. Therefore, this function communicates problems with variable types to the user but does not fix those problems for the user. It does tell the user exactly how to fix them though.*
#'
#' @srrstats {G2.6} *Ensure all one-dimensional inputs in new_data have been processed to match their corresponding inputs in the training data for the aorsf model. I.e., if a variable was a factor in the training data, it needs to be a factor with the exact same levels in the testing data. If a variable was an integer in the training data, it must also be an integer in the testing data.*
#'
#' If new data have an integer vector where the ref data
#' had a factor vector, orsf_predict() will yell! Also
#' it is good practice to make sure users are supplying
Expand Down Expand Up @@ -1600,8 +1578,6 @@ check_predict <- function(object,
fi_ref = get_fctr_info(object),
label_new = "new_data")

#' @srrstats {G2.16} *Throw hard errors if undefined values are detected.*

for(i in c(get_names_x(object))){

if(any(is.infinite(new_data[[i]]))){
Expand Down
21 changes: 0 additions & 21 deletions R/orsf.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@
#' @param object an untrained 'aorsf' object, created by setting
#' `no_fit = TRUE` in `orsf()`.
#'
#' @srrstats {ML5.0} *The result of applying orsf training processes results in a single model object.*
#'
#' @return an accelerated oblique RSF object (`aorsf`)
#'
#' @details
Expand Down Expand Up @@ -328,8 +326,6 @@ orsf <- function(data,
verbose_progress = FALSE,
...){

#' @srrstats {G2.8} *As part of initial pre-processing, run checks on inputs to ensure that all other sub-functions receive inputs of a single defined class or type.*

check_dots(list(...), .f = orsf)

if(!is.data.frame(data))
Expand Down Expand Up @@ -463,10 +459,6 @@ orsf <- function(data,
stop(msg, call. = FALSE)
}

#' @srrstats {G2.7} *aorsf accepts as input numeric and categorical predictor variables, including those with unit class. I do not think it is necessary to incorporate any other type of input, since it is relatively straightforward to convert data into a numeric or categorical format.*

#' @srrstats {G2.11} *I cannot write code for every possible vector class to ensure that the vector data will be safely coerced into a a valid class and the attributes will be stored in the orsf_out object. It is much easier and safer for the user to convert a few columns to numeric or factor than it is for me to attempt writing code that will safely coerce every type of vector. That being said, I do find units columns to be helpful and I've written some code to make them an allowable class in input data.*

types_x_data <- check_var_types(data,
names_x_data,
valid_types = c('numeric',
Expand All @@ -475,14 +467,6 @@ orsf <- function(data,
'factor',
'ordered'))

#' @srrstats {G2.6} *ensure that one-dimensional inputs are appropriately pre-processed. aorsf does not deal with missing data as many other R packages are very good at dealing with it.*

#' @srrstats {G2.13} *check for missing data as part of initial pre-processing prior to passing data to analytic algorithms.*

#' @srrstats {G2.15} *Never pass data with potential missing values to any base routines.*

#' @srrstats {G2.16} *Throw hard errors if undefined values are detected.*

for(i in c(names_y_data, names_x_data)){

if(any(is.infinite(data[[i]]))){
Expand Down Expand Up @@ -844,7 +828,6 @@ orsf <- function(data,
attr(orsf_out, 'sample_with_replacement') <- sample_with_replacement
attr(orsf_out, 'sample_fraction') <- sample_fraction

#' @srrstats {ML5.0a} *orsf output has its own class*
class(orsf_out) <- "orsf_fit"

if(importance != 'none' && !no_fit){
Expand Down Expand Up @@ -916,8 +899,6 @@ orsf_data_prep.recipe <- function(data, ...){

}

#' @srrstats {ML2.0a} *objects returned from orsf() with no_fit = TRUE can be directly submitted to orsf_train to train the model specification.*
#'
#' @rdname orsf
#' @export
orsf_train <- function(object){
Expand All @@ -928,8 +909,6 @@ orsf_train <- function(object){

#' Estimate training time
#'
#' @srrstats {ML4.5} *include a function to estimate likely time to train a specified model*
#'
#' @param object an untrained `aorsf` object
#'
#' @param n_tree_subset (_integer_) how many trees should be fit in order
Expand Down
3 changes: 0 additions & 3 deletions R/orsf_pd.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
#'
#' @inheritParams predict.orsf_fit
#'
#' @srrstats {G2.1a} *explicit secondary documentation of expectations on data types of all vector inputs*
#' @srrstats {G2.0a} *documenting length by indicating these inputs are vectors and that they must have the same length as the other.*
#'
#'
#' @param pred_spec (*named list* or _data.frame_).
#'
Expand Down
7 changes: 0 additions & 7 deletions R/orsf_predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
#'
#' Predicted risk, survival, hazard, or mortality from an ORSF model.
#'
#' @srrstats {G1.4} *documented with Roxygen*
#' @srrstats {ML1.1} *using the terms 'train' and 'test'.*
#' @srrstats {G2.0a} *specified expectations for length of `pred_horizon`. In general, inputs of length > 1 have the term 'vector' in their description, and inputs of length 1 just have the expected type.*
#' @srrstats {G2.1a} *explicit secondary documentation of expectations on data types of all vector inputs*
#' @srrstats {G2.8} *As part of initial pre-processing, run checks on inputs to ensure that all other sub-functions receive inputs of a single defined class or type.*
#' @srrstats {ML1.1} *The term 'new_data' are used instead of data_test. There are two reasons for this. First, I am making an effort to be consistent with tidymodels. Second, there is a possibility that users will use predict() without the intention of testing their model, e.g., for interpretation.*
#'
#' @param object (*orsf_fit*) a trained oblique random survival forest
#' (see [orsf]).
#'
Expand Down
6 changes: 0 additions & 6 deletions R/orsf_print.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
#' - OOB stat type: How was out-of-bag error computed?
#' - Variable importance: How was variable importance computed?
#'
#' @srrstats {ML3.0d} *object returned by orsf() has a defined class with `print` method that summarises the model specification and other relevant parameters. The output also indicates whether the orsf oject was trained or not.*
#'
#' @srrstats {ML5.0b} *aorsf objects have a defined `print` method which summarises important aspects of the model object.*
#'
#' @srrstats {G1.4} *documented with Roxygen*
#'
#' @param x (*orsf_fit*) an oblique random survival forest (ORSF; see [orsf]).
#'
#' @param ... `r roxy_dots()`
Expand Down
2 changes: 0 additions & 2 deletions R/orsf_scale_cph.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#'
#' @return the scaled or unscaled `x_mat`.
#'
#' @srrstats {ML2.7} *Provide documentation on how transforms may be reversed.*
#' @details The data are transformed by first subtracting the mean and then
#' multiplying by the scale. An inverse transform can be completed using
#' `orsf_unscale_cph` or by dividing each column by the corresponding scale
Expand All @@ -27,7 +26,6 @@
#' The values of means and scales are stored in an attribute of the output
#' returned by `orsf_scale_cph` (see examples)
#'
#' @srrstats {ML2.6} *export transforms to namespace so they can be applied in other contexts.*
#' @export
#'
#' @examples
Expand Down
6 changes: 0 additions & 6 deletions R/orsf_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ orsf_summarize_uni <- function(object,
# for CRAN check:
medn <- name <- value <- level <- variable <- NULL

#' @srrstats {G2.8} *As part of initial pre-processing, run checks on inputs to ensure that all other sub-functions receive inputs of a single defined class or type.*

check_arg_is(arg_value = object,
arg_name = 'object',
expected_class = 'orsf_fit')
Expand Down Expand Up @@ -133,8 +131,6 @@ orsf_summarize_uni <- function(object,

if(x_name %in% colnames(x_numeric_key)){

#' @srrstats {G2.4b} explicit conversion to continuous values

pred_spec[[x_name]] <- unique(
as.numeric(x_numeric_key[c('25%','50%','75%'), x_name])
)
Expand Down Expand Up @@ -203,8 +199,6 @@ orsf_summarize_uni <- function(object,

#' Print ORSF summary
#'
#' @srrstats {G1.4} *documented with Roxygen*
#'
#' @param x an object of class 'orsf_summary'
#'
#' @param n_variables The number of variables to print
Expand Down

0 comments on commit d476280

Please sign in to comment.