Skip to content

Commit

Permalink
reverse compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
TGuillerme committed Oct 22, 2024
1 parent be389a8 commit dc4bfd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions R/dispRity.R
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,22 @@ dispRity <- function(data, metric, dimensions = NULL, ..., between.groups = FALS
dist.data <- FALSE
}
## Check if bootstraps has distance
if(!is.null(data$call$bootstrap) && data$call$bootstrap[[4]] == "dist") {
if(!is.null(data$call$bootstrap) && length(data$call$bootstrap) > 3 && data$call$bootstrap[[4]] == "dist") {
dist.data <- TRUE
}
} else {
## Check class
check.class(dist.data, "logical")
## Check conflict?
if(!dist.data) {
if((!is.null(data$call$dist.data) && data$call$dist.data) || (!is.null(data$call$bootstrap) && data$call$bootstrap[[4]] == "dist")) {
if((!is.null(data$call$dist.data) && data$call$dist.data) || (!is.null(data$call$bootstrap) && length(data$call$bootstrap) > 3 && data$call$bootstrap[[4]] == "dist")) {
warning(paste0("data.dist is set to FALSE (the data will not be treated as a distance matrix) even though ", match_call$data, " contains distance treated data."))
}
}
}

## Check do_by.col from bootstraps
do_by.col <- ifelse(!is.null(data$call$bootstrap) && data$call$bootstrap[[4]] == "columns", TRUE, FALSE)
do_by.col <- ifelse(!is.null(data$call$bootstrap) && length(data$call$bootstrap) > 3 && data$call$bootstrap[[4]] == "columns", TRUE, FALSE)

## Serial
is_between.groups <- FALSE
Expand Down
2 changes: 1 addition & 1 deletion R/print.dispRity.R
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ print.dispRity <- function(x, all = FALSE, ...) {
if(x$call$bootstrap[[2]] == "covar") {
cat(paste0("Data is based on ", length(x$covar[[1]]), " posterior sample", ifelse(length(x$covar[[1]]) > 1, "s","")))
} else {
if(!is.null(x$call$bootstrap[[4]])) {
if(length(x$call$bootstrap) > 3 && !is.null(x$call$bootstrap[[4]])) {
cat(paste(ifelse(x$call$bootstrap[[4]] == "dist", "Rows and columns",paste(toupper(substr(x$call$bootstrap[[4]], 1, 1)), substr(x$call$bootstrap[[4]], 2, nchar(x$call$bootstrap[[4]])), sep="")), " were bootstrapped ", x$call$bootstrap[[1]], " times (method:\"", x$call$bootstrap[[2]], "\")", sep = ""))
} else {
cat(paste("Rows were bootstrapped ", x$call$bootstrap[[1]], " times (method:\"", x$call$bootstrap[[2]], "\")", sep = ""))
Expand Down

0 comments on commit dc4bfd4

Please sign in to comment.