[Rd] scale in stars() is not as documented (PR#1230)
ripley@stats.ox.ac.uk
ripley@stats.ox.ac.uk
Thu, 27 Dec 2001 12:28:46 +0100 (MET)
R 1.4.0
?stars has
scale: logical flag: if `TRUE', the columns of the data matrix are
scaled independently so that the maximum value in each column
is 1 and the minimum is 0. If `FALSE', the presumption is
that the data have been scaled by some other algorithm to the
range [0,1].
but the code has
if (scale) {
x <- sweep(x, 2, apply(x, 2, max), FUN = "/")
x[is.na(x)] <- 0
}
and so just linearly (not affinely) scales the maximum to one. The result
is very different star plots from the S original. Try
stars(state.x77[, c(7, 4, 6, 2, 5, 3)])
compared to
stars(state.x77[, c(7, 4, 6, 2, 5, 3)], byrow = T) # in S
I suspect we should fix the code, but does anyone rely on it?
BTW, it is hard to think of a more inefficient way to write that
scaling!
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._