# Warning: ignored non function "scale"

**Paul Gilbert
**
pgilbert@bank-banque-canada.ca

*Fri, 24 Apr 1998 12:49:40 -0400*

I've been working on a revised version of prcomp and princomp. Below is my
current draft of prcomp, which is marginally different from V&R. I've added
center and scale as optional arguments. However, scale causes the following:
>* zi _ prcomp(iris[,,2])
*Warning: ignored non function "scale"
because scale is both a variable and a function. Is there any way to avoid this
error message and still keep the name scale for both the argument and the name
of the function?
Paul Gilbert
______
prcomp <- function(x, retx=TRUE, center=TRUE, scale=FALSE) {
s <- svd(scale(x, center=center, scale=scale),nu=0)
# rank <- sum(s$d > 0)
rank <- sum(s$d > (s$d[1]*sqrt(.Machine$double.eps)))
if (rank < ncol(x)) s$v <- s$v[,1:rank]
s$d <- s$d/sqrt(max(1,nrow(x) -1))
if(retx) list(sdev=s$d, rotation=s$v, x=x %*% s$v)
else list(sdev=s$d, rotation=s$v)
}
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._