svd()function computes the singular-value decomposition of a rectangular matrix.
svd(x, nu = min(n, p), nv = min(n, p), LINPACK = FALSE) La.svd(x, nu = min(n, p), nv = min(n, p))
x: a numeric, logical or complex matrix
nu: the number of left singular vectors to be computed. This must between 0 and n = nrow(x)
nv: the number of right singular vectors to be computed. This must be between 0 and p = ncol(x)
LINPACK: logical. Should LINPACK be used (for compatibility with R < 1.7.0)? In this case nu must be 0, nrow(x) or ncol(x)
> x <- matrix(1:16,4,4) > x
[,1] [,2] [,3] [,4] [1,] 1 5 9 13 [2,] 2 6 10 14 [3,] 3 7 11 15 [4,] 4 8 12 16
> svd(x)
$d [1] 3.862266e+01 2.071323e+00 2.076990e-15 4.119458e-16 $u [,1] [,2] [,3] [,4] [1,] -0.4284124 -0.7186535 0.43803202 0.3288281 [2,] -0.4743725 -0.2738078 -0.82913672 -0.1119477 [3,] -0.5203326 0.1710379 0.34417739 -0.7625890 [4,] -0.5662928 0.6158835 0.04692732 0.5457086 $v [,1] [,2] [,3] [,4] [1,] -0.1347221 0.82574206 0.5322301 -0.1293488 [2,] -0.3407577 0.42881720 -0.6132292 0.5691660 [3,] -0.5467933 0.03189234 -0.3702319 -0.7502855 [4,] -0.7528288 -0.36503251 0.4512310 0.3104683