[Vegan-commits] r2754 - pkg/permute/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Nov 24 17:36:31 CET 2013
Author: gsimpson
Date: 2013-11-24 17:36:31 +0100 (Sun, 24 Nov 2013)
New Revision: 2754
Modified:
pkg/permute/R/setFoo-methods.R
Log:
fix a few copy-paste errors; be more defensive about what 'value' is and coerce to appropriate types
Modified: pkg/permute/R/setFoo-methods.R
===================================================================
--- pkg/permute/R/setFoo-methods.R 2013-11-24 16:30:50 UTC (rev 2753)
+++ pkg/permute/R/setFoo-methods.R 2013-11-24 16:36:31 UTC (rev 2754)
@@ -67,12 +67,16 @@
}
`setComplete<-.how` <- function(object, value) {
+ if (!is.null(value))
+ value <- rep(as.logical(value), length.out = 1)
object[["complete"]] <- value
object <- fixupCall(object, "complete", value)
object
}
`setComplete<-.permControl` <- function(object, value) {
+ if (!is.null(value))
+ value <- rep(as.logical(value), length.out = 1)
object[["complete"]] <- value
object <- fixupCall(object, "complete", value)
object
@@ -87,12 +91,16 @@
}
`setAllperms<-.how` <- function(object, value) {
+ if (!is.null(value))
+ value <- as.matrix(value)
object[["all.perms"]] <- value
object <- fixupCall(object, "all.perms", value)
object
}
`setAllperms<-.permControl` <- function(object, value) {
+ if (!is.null(value))
+ value <- as.matrix(value)
object[["all.perms"]] <- value
object <- fixupCall(object, "all.perms", value)
object
@@ -107,13 +115,17 @@
}
`setMake<-.how` <- function(object, value) {
+ if (!is.null(value))
+ value <- rep(as.logical(value), length.out = 1)
object[["make"]] <- value
object <- fixupCall(object, "make", value)
object
}
`setMake<-.permControl` <- function(object, value) {
- object[["all.perms"]] <- value
+ if (!is.null(value))
+ value <- rep(as.logical(value), length.out = 1)
+ object[["make"]] <- value
object <- fixupCall(object, "make", value)
object
}
@@ -127,6 +139,8 @@
}
`setBlocks<-.how` <- function(object, value) {
+ if (!is.null(value))
+ value <- as.factor(value)
object["blocks"] <- list(value)
object[["blocks.name"]] <- deparse(substitute(value))
object <- fixupCall(object, "blocks", value)
@@ -134,6 +148,8 @@
}
`setBlocks<-.permControl` <- function(object, value) {
+ if (!is.null(value))
+ value <- as.factor(value)
object["blocks"] <- list(value)
object[["blocks.name"]] <- deparse(substitute(value))
object <- fixupCall(object, "blocks", value)
@@ -149,13 +165,17 @@
}
`setObserved<-.how` <- function(object, value) {
+ if (!is.null(value))
+ value <- rep(as.logical(value), length.out = 1)
object[["observed"]] <- value
object <- fixupCall(object, "observed", value)
object
}
`setObserved<-.permControl` <- function(object, value) {
- object[["all.perms"]] <- value
+ if (!is.null(value))
+ value <- rep(as.logical(value), length.out = 1)
+ object[["observed"]] <- value
object <- fixupCall(object, "observed", value)
object
}
More information about the Vegan-commits
mailing list