R/RCBDTest.R

#' @title RCBDTest Class
#' 
#' @description Abstract class for tests on samples collected in randomized complete block designs.
#' 
#' @aliases class.rcbd
#' 
#' @importFrom R6 R6Class


RCBDTest <- R6Class(
    classname = "RCBDTest",
    inherit = PermuTest,
    cloneable = FALSE,
    private = list(
        .preprocess = function() {
            if (length(unique(lengths(private$.raw_data, FALSE))) > 1) {
                stop("All samples must be of equal length")
            }

            private$.data <- unname(do.call(cbind, private$.raw_data))
        },

        .calculate_score = function() {
            private$.data <- apply(
                X = private$.data, MARGIN = 2, FUN = get_score,
                scoring = private$.scoring, n = nrow(private$.data)
            )
        },

        .calculate_statistic = function() {
            private$.statistic <- rcbd_pmt(
                private$.data,
                private$.statistic_func,
                if (private$.type == "permu") private$.n_permu else NA_real_,
                isTRUE(getOption("LearnNonparam.pmt_progress"))
            )
        }
    )
)

Try the LearnNonparam package in your browser

Any scripts or data that you put into this service are public.

LearnNonparam documentation built on June 8, 2025, 1:46 p.m.