[R] Help on Principal Component Analysis in R

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Wed Jan 14 00:49:35 CET 2015

I'd you keep reading the help file, the answer to your question is right there.

As for step by step... only you know what your data looks like. There are various pitfalls one can encounter in getting data from a file into an object in memory, but the basic idea is to use the read.csv function, and then optionally the str function to verify that it has been read in properly. There is a whole document that comes with R to show you how to get data into and out of R, and a reproducible example is needed if we are to be able to give specific guidance. [1]

Oh and there is a Posting Guide that you should read mentioned at the bottom if this and every message on the list. Among the valuable nuggets in there is a statement that this is a plain text mailing list (HTML email gets stripped to text do we don't necessarily see what you see), so please send plain text only so you know what we will see.

[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On January 13, 2015 3:17:11 PM PST, R Help! <emanekaf5 at gmail.com> wrote:
>I am a beginner to R. I have read several guides, but still am stuck on
>I have data in an excel csv file, on which I want to run PCA.
>I'm not sure how the prcomp formula works. The help page states:
>prcomp(x, retx = TRUE, center = TRUE, scale. = FALSE,
>tol = NULL, ...)
>what is x referring to? I tried putting the file name for x, but i get
>following error:
>Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric
>what kind of numeric value do I need to put in for x?
>Potentially helpful information: my data sheet has around 48 columns
>over 7000 rows. I have converted the csv file into a matrix in R.
>Thanks in advance for all your help.
>I'd appreciate step by step instructions on how to go from my csv file
>to a
>PCA biplot in R.
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list