[R] Data consideration in executing pca

Jiji Sid j|j|21216 @end|ng |rom gm@||@com
Fri Feb 23 23:06:40 CET 2024


Dear R users,

 I have a txt file named 'data_1.txt' whose first column contains the names
of the individuals and the other columns contain the values of four
variables X_1,X_2,X_3 and X_4. I read it with R from its location and
called it data. I'd like to do a normalized principal component analysis. I
started by calculating the correlation matrix:
cor(data)
 I got the following message:
Error in cor(nnotes) : 'x' must be numeric.
I eliminated the first column of names, then read the modified data and
then added the names of individuals with rownames. I was able to run PCA
and obtain graphical representations of the variables, their coordinates,
contributions and cos2. However, when I used fviz_pca_ind to get the
graphical representation of the individuals, I got a graphic that considers
the variables as individuals. Can you please help me? I have attached the
file data_1 .txt file.

Many thanks in advance.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: data_1.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20240223/039cec99/attachment.txt>


More information about the R-help mailing list