txPca.RdtxPca transforms data using principal component analysis.
TODO
txPca(x, k = 3, ...)
| x | a data matrix (features in columns, samples in rows) |
|---|---|
| k | number of dimensions of the result, defaults to 3 in order
to be usable in |
| ... | additional arguments to |
Transform function taking two arguments: a data matrix y
to transform, and a logical center determining whether
the data are to be centered, or not. The parameters of the
transform get returned in the params attribute (see
prcomp).
In addition, there is the varExplained function added to
the parameters, which takes k, the number of components,
and returns the contribution of individual dimensions to the top
k components.
prcomp, txSpca,
plot3dProj
tx<-txPca(iris[,1:4]) plot(tx(iris[,1:4])[,1:2],pch=19,col=c('red','green','blue')[as.numeric(iris$Species)])if (interactive() && require(rgl)) { # a 3D example x<-iris[,1:4] y<-iris$Species plot3dProj(x, cls=y, tx=txPca(x)) }