Skip to content
Prev 155838 / 398502 Next

Save object summary to file

Hi,

The returned value of summary.princomp() is NOT a data.frame and
cannot be coerced into a data.frame (it's a list), so you cannot write
it into a file using write.table().

I guess what you really intend to write is:

#################################################################
x <- summary(PCA)
vars <- x$sdev^2
vars <- vars/sum(vars)
write.table(rbind("Standard deviation" = x$sdev, "Proportion of
Variance" = vars,
        "Cumulative Proportion" = cumsum(vars), file="PCAvar.txt", sep="\t")
#################################################################

Yihui
On Fri, Sep 12, 2008 at 7:51 AM, pgseye <prseye at gmail.com> wrote: