0

The code beneath depicts my current data structure. I wish to run a PCA test, to which I would like to have my data in the following format.

Country.Code         Y_variable        X1               X2                X3           X4
1          AZE           5.212      100.00000         100.00000         100.00000    53.19880
4          KEN           4.419       41.60000          29.00259          78.10000    79.50800
5          KWT           6.295      100.00000         100.00000         100.00000     8.69480
7          LAO              NA       89.70000          85.69093          97.80000    66.31240
8          LTE              NA       98.83107          98.98426          98.82399    21.57687
9          LCN              NA       97.28134          89.03965          99.36275    65.11290

As you can see the prior column Country.Code is no longer a column but now seemingly on the Y-axis of the structure.

##         Y_variable X1       X2       X3    X4           X5 
## AZE     11       7.58     14.8      2.07  49.8         14.7
## KEN     10      7.40     14.3      1.86  49.4         14.1
## KWT     11      7.23     14.2      1.92  48.9         15.0
## LAO     11      7.09     15.2      2.10  50.4         15.3
Kash
  • 99
  • 4

0 Answers0