-## dist.gene.R (2008-07-18)
+## dist.gene.R (2009-04-01)
## Pairwise Distances from Genetic Data
-## Copyright 2002-2008 Emmanuel Paradis
+## Copyright 2002-2009 Emmanuel Paradis
## This file is part of the R-package `ape'.
## See the file ../COPYING for licensing issues.
function(x, method = "pairwise", pairwise.deletion = FALSE,
variance = FALSE)
{
- if (!is.data.frame(x) || !is.matrix(x))
+ if (!is.data.frame(x) && !is.matrix(x))
stop("'x' should be a matrix or a data.frame")
method <- match.arg(method, c("pairwise", "percentage"))
if (!pairwise.deletion) {
## delete the columns with at least one NA:
del <- apply(x, 2, function(xx) any(is.na(xx)))
- x <- x[, -del]
+ x <- x[, !del]
}
n <- dim(x)
L <- n[2]
attr(D, "Size") <- n
attr(D, "Labels") <- dimnames(x)[[1]]
- attr(D, "Diag") <- attr(d, "Upper") <- FALSE
+ attr(D, "Diag") <- attr(D, "Upper") <- FALSE
attr(D, "call") <- match.call()
attr(D, "method") <- method
class(D) <- "dist"