[R] Help on Principal Component Analysis in R

Brandstätter Christian bran.chri at gmail.com
Wed Jan 14 09:41:30 CET 2015


Hi,

it could also be that during reading your csv the matrix became a character
matrix.
Try str(x); this should show you if your values are seen as numeric.
Also, if you have descriptive columns (e.g. date, labels, etc.) they must
be removed before calculating PCR.

With best regards
Brandstätter Christian

2015-01-14 0:17 GMT+01:00 R Help! <emanekaf5 at gmail.com>:

> Hello!
>
> I am a beginner to R. I have read several guides, but still am stuck on
> this:
>
> 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 the
> 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 and
> 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
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list