[Analogue-commits] r243 - in pkg: . R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Oct 8 11:28:41 CEST 2011
Author: gsimpson
Date: 2011-10-08 11:28:41 +0200 (Sat, 08 Oct 2011)
New Revision: 243
Modified:
pkg/DESCRIPTION
pkg/R/Stratiplot.R
pkg/inst/ChangeLog
Log:
fix broken absolute data types in Stratiplot
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2011-09-20 09:09:04 UTC (rev 242)
+++ pkg/DESCRIPTION 2011-10-08 09:28:41 UTC (rev 243)
@@ -1,7 +1,7 @@
Package: analogue
Type: Package
Title: Analogue and weighted averaging methods for palaeoecology
-Version: 0.7-5
+Version: 0.7-6
Date: $Date$
Depends: R (>= 2.10.0), stats, graphics, vegan (>= 1.17-12), lattice, grid,
MASS, princurve
Modified: pkg/R/Stratiplot.R
===================================================================
--- pkg/R/Stratiplot.R 2011-09-20 09:09:04 UTC (rev 242)
+++ pkg/R/Stratiplot.R 2011-10-08 09:28:41 UTC (rev 243)
@@ -99,15 +99,14 @@
ylim <- rev(ylim)
## process the column/variable types
## If varTypes of length one replicate it to NCOL(x)
- if((typeLen <- length(varTypes)) != 1L) {
+ if(isTRUE(all.equal(length(varTypes), 1L)))
varTypes <- rep(varTypes, length = n.vars)
- ## If typeLen != 1 or NCOL shout warning
- if(typeLen != n.vars) {
- warning("Length of 'varTypes' not 1 or equal to number of variables. Recycling or truncating of 'varTypes' as a result.")
- }
+ ## If typeLen != 1 or NCOL shout warning
+ if(length(varTypes) != n.vars) {
+ warning("Length of 'varTypes' not 1 or equal to number of variables. Recycling or truncating of 'varTypes' as a result.")
}
## Only allow two types of variables: "relative", "absolute"
- if(any(!(varTypes%in% c("relative", "absolute"))))
+ if(any(!(varTypes %in% c("relative", "absolute"))))
stop("Ambiguous entry in 'varTypes'.\nMust be one of \"relative\", or \"absolute\"")
## compute max abundances per relative column, which is used
## to scale the panel widths layout.widths parameter)
@@ -116,7 +115,11 @@
panelWidths <- max.abun
ABS <- which(varTypes == "absolute")
REL <- which(varTypes == "relative")
- panelWidths[ABS] <- absoluteSize * max(max.abun[REL])
+ if(any(REL)) {
+ panelWidths[ABS] <- absoluteSize * max(max.abun[REL])
+ } else {
+ panelWidths[ABS] <- absoluteSize
+ }
## xlim in xyplot call
xlimits <- lapply(max.abun * 1.05, function(x) c(0, x))
if(any(ABS)) {
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2011-09-20 09:09:04 UTC (rev 242)
+++ pkg/inst/ChangeLog 2011-10-08 09:28:41 UTC (rev 243)
@@ -1,5 +1,12 @@
analogue Change Log
+Version 0.7-6
+
+ * Stratiplot: Handling of absolute data types was broken. Fix
+ applied that should allow this to work if there are only
+ absolute scale variables or a mix or relative and absolute
+ data. All reletaive data should be unaffected.
+
Version 0.7-5
* weightedCor: implements one of the tests from Telford & Birks
More information about the Analogue-commits
mailing list