Skip to content

Commit

Permalink
Remove deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Dec 16, 2024
1 parent 089878a commit 8f704ec
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 67 deletions.
56 changes: 0 additions & 56 deletions R/tabula-deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
)
11 changes: 0 additions & 11 deletions man/tabula-deprecated.Rd

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

0 comments on commit 8f704ec

Please sign in to comment.