[Analogue-commits] r193 - in pkg: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 29 17:56:24 CEST 2010
Author: gsimpson
Date: 2010-09-29 17:56:24 +0200 (Wed, 29 Sep 2010)
New Revision: 193
Modified:
pkg/R/tran.R
pkg/inst/ChangeLog
Log:
improve the replacement of missing values
Modified: pkg/R/tran.R
===================================================================
--- pkg/R/tran.R 2010-09-22 16:23:26 UTC (rev 192)
+++ pkg/R/tran.R 2010-09-29 15:56:24 UTC (rev 193)
@@ -4,6 +4,10 @@
`tran.default` <- function(x, method, a = 1, b = 0, p = 2, base = exp(1),
na.rm = FALSE, na.value = 0, ...) {
+ repMissing <- function(x, na.value) {
+ x[is.na(x)] <- na.value
+ return(x)
+ }
wasDF <- is.data.frame(x)
dim.nams <- dimnames(x)
x <- data.matrix(x)
@@ -32,9 +36,7 @@
center = scale(x, scale = FALSE, center = TRUE),
percent = sweep(x, 1, rowSums(x), "/") * 100,
proportion = sweep(x, 1, rowSums(x), "/"),
- missing = apply(x, 2,
- function(x) {x[is.na(x)] <- na.value
- x}),
+ missing = repMissing(x, na.value),
pcent2prop = x / 100,
prop2pcent = x * 100,
logRatio = {x <- sweep(x, 2, a, "*")
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2010-09-22 16:23:26 UTC (rev 192)
+++ pkg/inst/ChangeLog 2010-09-29 15:56:24 UTC (rev 193)
@@ -16,6 +16,8 @@
species in order to fit the principal curve. 'initCurve'
implements several methods for initialising the principal curve.
+ * tran: improvements to the underlying code.
+
Version 0.6-26
* abernethy: New data set containing the classic Abernethy Forest
More information about the Analogue-commits
mailing list