ripley@stats.ox.ac.uk
2001-Dec-27 11:28 UTC
[Rd] scale in stars() is not as documented (PR#1230)
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
maechler@stat.math.ethz.ch
2001-Dec-31 13:40 UTC
[Rd] scale in stars() is not as documented (PR#1230)
>>>>> "BDR" == Brian D Ripley <ripley@stats.ox.ac.uk> writes:BDR> R 1.4.0 ?stars has BDR> scale: logical flag: if `TRUE', the columns of the BDR> data matrix are scaled independently so that the BDR> maximum value in each column is 1 and the minimum is 0. BDR> If `FALSE', the presumption is that the data have been BDR> scaled by some other algorithm to the range [0,1]. BDR> but the code has BDR> if (scale) { x <- sweep(x, 2, apply(x, 2, max), FUN BDR> = "/") x[is.na(x)] <- 0 } BDR> and so just linearly (not affinely) scales the maximum BDR> to one. The result is very different star plots from BDR> the S original. Try BDR> stars(state.x77[, c(7, 4, 6, 2, 5, 3)]) BDR> compared to BDR> stars(state.x77[, c(7, 4, 6, 2, 5, 3)], byrow = T) # in S BDR> I suspect we should fix the code, but does anyone rely BDR> on it? BDR> BTW, it is hard to think of a more inefficient way to BDR> write that scaling! Thank you, Brian, for fixing it (for R-patched i.e. R 1.4.1 to be). Note that the scale thing all came from the original ### T. Dye <tdye@lava.net>, July 1999 ### This code started life as spatial star plots by David A. Andrews. ### See http://www.stat.rice.edu/~andrewsd/software/software.html. (and that code was at least a start,..) We had just done some (as you saw) `not quite perfect' NA handling. Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._