I am doing SVD in R on a data frame called data
svd1 <- svd(scale(data))
I plot the result using
plot(svd1$d^2/sum(svd1$d^2),xlab="Column",ylab="Percent of variance explained",pch=19)
I found out that in the plot, column number do not corespond to the column numbers in the data frame (no matter what subset of columns I use with SVD, the first column always shows the highes variance).
My question is, how do I get the column names (or “real” indices) in the plot?
According to the R documentation (…/library/base/html/svd.html):
These singular values are computed by the SVD algorithm from the whole input matrix, so there is no way to label the singular values based on the column names.