[R] exporting an output of an analysis

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Jan 9 10:45:26 CET 2002


Indbryn Morten <Morten.Indbryn at indman.sintef.no> writes:

> Hi
>  
> I am now doing a principal component analysis for a data set. This dataset
> inludes above 100 variables so the output matrix of the analysis is also
> big. Because the output matrix is so huge it is a problem to use the browser
> of R to look at the analysis. Therefor I want to export the solution of the
> principal component analysis to another tool which better fittet for viewing
> big matrixes/outputs (e.g a database or spreadsheet)
>  
> The problem is the data format of the output of the solution. It is a
> mixture of text and numbers. I have tried to convert the output solution to
> a matrix or a dataframe but is not possible because of the text in the
> analysis.
>  
> If somebody have an idea of how to view the output of the analysis in a good
> way, I would have been really greatfull

[A general output delivery system for R could be a good idea, but it
looks like a massive undertaking...]

You probably need to extract just the loadings from the princomp
objects before converting them to a dataframe.

You might then use write.table() to a CSV file and import it to
Excel/Gnumeric/whatever

Or maybe use

view.mat <- function(m)invisible(edit(as.data.frame(m)))

as in 

pc <- princomp(....)
summary(pc)
view.mat(loadings(pc))

(I don't use PCA enough to remember the relative usefulness of
princomp and prcomp...)


BTW: The summary() method for princomp has explicit print() statements
inside, which I think we now consider bad style. It should generate an
object of class "summary.princomp" and there ought to be a
print.summary.princomp() doing the actual printing.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list