Subversion Repositories bdplot

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
38 pdel 1
bdbiplot.princomp <- function (x, choices = 1:2, scale = 1, pc.biplot = FALSE, ...) 
2
{
3
    if (length(choices) != 2) 
4
        stop("length of choices must be 2")
5
    if (!length(scores <- x$x)) 
6
        stop(gettextf("object '%s' has no scores", deparse(substitute(x))), 
7
            domain = NA)
8
    if (is.complex(scores)) 
9
        stop("biplots are not defined for complex PCA")
10
    lam <- x$sdev[choices]
11
    n <- NROW(scores)
12
    lam <- lam * sqrt(n)
13
    if (scale < 0 || scale > 1) 
14
        warning("'scale' is outside [0, 1]")
15
    if (scale != 0) 
16
        lam <- lam^scale
17
    else lam <- 1
18
    if (pc.biplot) 
19
        lam <- lam/sqrt(n)
20
    bdbiplot.default(t(t(scores[, choices])/lam), t(t(x$rotation[, 
21
        choices]) * lam), ...)
22
    invisible()
23
}