From 8f704ec5d6c05833b2981ddf25f3f04027de2fed Mon Sep 17 00:00:00 2001 From: nfrerebeau Date: Mon, 16 Dec 2024 18:45:33 +0100 Subject: [PATCH] Remove deprecated methods --- R/tabula-deprecated.R | 56 ---------------------------------------- man/tabula-deprecated.Rd | 11 -------- 2 files changed, 67 deletions(-) diff --git a/R/tabula-deprecated.R b/R/tabula-deprecated.R index 3efbf22f..745c16bf 100644 --- a/R/tabula-deprecated.R +++ b/R/tabula-deprecated.R @@ -4,59 +4,3 @@ #' @name tabula-deprecated #' @keywords internal NULL - -#' @rdname tabula-deprecated -#' @aliases test_diversity-method -setGeneric( - name = "test_diversity", - def = function(object, ...) standardGeneric("test_diversity") -) - -#' @export -#' @rdname tabula-deprecated -#' @aliases test_diversity,matrix-method -setMethod( - f = "test_diversity", - signature = signature(object = "matrix"), - definition = function(object, adjust = "holm", ...) { - .Deprecated(new = "test_shannon()", old = "test_diversity()") - - # Calculate the number of individuals - N <- rowSums(object) - # Calculate Shannon diversity - H <- apply(X = object, MARGIN = 1, FUN = index_shannon, ...) - # Calculate Shannon variance - V <- apply(X = object, MARGIN = 1, FUN = variance_shannon, ...) - # Get the names of the assemblages - row_names <- rownames(object) - if (length(row_names) != 0) { - row_names <- factor(row_names, levels = unique(row_names)) - } else { - row_names <- factor(seq_len(nrow(object))) - } - # Compute t test - compare <- function(i, j) { - tt <- (H[i] - H[j]) / sqrt(V[i] + V[j]) - df <- (V[i] + V[j])^2 / sum(V[c(i, j)]^2 / N[c(i, j)]) - 2 * (1 - stats::pt(q = abs(tt), df = df)) - } - result <- stats::pairwise.table( - compare.levels = compare, - level.names = row_names, - p.adjust.method = adjust - ) - return(result) - } -) - -#' @export -#' @rdname tabula-deprecated -#' @aliases test_diversity,data.frame-method -setMethod( - f = "test_diversity", - signature = signature(object = "data.frame"), - definition = function(object, adjust = "holm", ...) { - object <- data.matrix(object) - methods::callGeneric(object, adjust = adjust) - } -) diff --git a/man/tabula-deprecated.Rd b/man/tabula-deprecated.Rd index 1a6a9d89..f2a78ba3 100644 --- a/man/tabula-deprecated.Rd +++ b/man/tabula-deprecated.Rd @@ -2,18 +2,7 @@ % Please edit documentation in R/tabula-deprecated.R \name{tabula-deprecated} \alias{tabula-deprecated} -\alias{test_diversity} -\alias{test_diversity-method} -\alias{test_diversity,matrix-method} -\alias{test_diversity,data.frame-method} \title{Deprecated Functions in tabula} -\usage{ -test_diversity(object, ...) - -\S4method{test_diversity}{matrix}(object, adjust = "holm", ...) - -\S4method{test_diversity}{data.frame}(object, adjust = "holm", ...) -} \description{ These functions still work but will be removed (defunct) in the next version. }