Ejercicio 3

Cargar los datos

G_BAR<-read.csv2("G_BAR.csv", header = TRUE, sep="", dec=".")

Datos sin estandarizar

G<-prcomp(G_BAR[,-1])
summary(G)
## Importance of components:
##                            PC1     PC2     PC3     PC4     PC5     PC6
## Standard deviation     25.6861 17.8448 5.93262 2.59862 1.95431 1.54153
## Proportion of Variance  0.6419  0.3098 0.03424 0.00657 0.00372 0.00231
## Cumulative Proportion   0.6419  0.9516 0.98589 0.99246 0.99618 0.99849
##                            PC7
## Standard deviation     1.24660
## Proportion of Variance 0.00151
## Cumulative Proportion  1.00000
plot(G)

biplot(G)

Datos estandarizados

G.s<-prcomp(G_BAR[,-1], scale. = TRUE)
summary(G.s)
## Importance of components:
##                           PC1    PC2    PC3     PC4     PC5     PC6
## Standard deviation     2.0988 1.0068 0.9904 0.60813 0.34479 0.26970
## Proportion of Variance 0.6293 0.1448 0.1401 0.05283 0.01698 0.01039
## Cumulative Proportion  0.6293 0.7741 0.9142 0.96702 0.98400 0.99439
##                            PC7
## Standard deviation     0.19815
## Proportion of Variance 0.00561
## Cumulative Proportion  1.00000
plot(G.s)

biplot(G.s, pc.biplot = TRUE)

Gráfico agrupando por sitios donde fueron tomadas las muestras

require(ggfortify)
## Loading required package: ggfortify
## Loading required package: ggplot2
autoplot(prcomp(G_BAR[,-1], scale. = TRUE), data=G_BAR, colour="V1", shape=FALSE,
         loadings = TRUE, loadings.label = TRUE)