setwd("~/Dropbox/Clases_UPJ/Estudios de Vegetación/Danielaura")
pcada<-read.table("datos.csv", sep=";",header=T)
pcada
##    Parcela Cuadrante Individuo     AB Peso.total..g. Grosor AF..cm.
## 1        1         1         1  23.00           2.95   0.21   27.45
## 2        1         1         2  64.64           4.29   0.31  124.41
## 3        1         1         3  39.40           2.87   0.30    6.94
## 4        1         1         4  22.33           2.07   0.30    6.52
## 5        1         1         5 108.94           5.62   0.36  102.81
## 6        1         1         6   7.96           0.67   0.25    4.07
## 7        1         2         7  19.43           1.81   0.27    8.24
## 8        1         2         8 122.28           0.92   0.16   42.88
## 9        1         2         9  97.48           3.87   0.35   79.47
## 10       1         2        11  53.79           0.96   0.25    6.76
## 11       1         2        12  13.45           2.10   0.28    8.17
## 12       1         2        13  11.46           1.11   0.26    5.81
## 13       2         3         1  12.77           1.32   0.27    9.80
## 14       2         3         3   3.72           1.27   0.25    5.40
## 15       2         3         4   5.75           1.13   0.29    3.75
## 16       2         3         5   6.45           1.95   0.16   22.63
## 17       2         3         6  14.03           1.76   0.26    6.46
## 18       2         3         7  35.09           4.36   0.26   37.48
## 19       2         3         8   9.34           0.79   0.23    5.63
## 20       2         3         9   9.41           1.45   0.25    6.13
## 21       2         3        10  11.46           1.35   0.22    5.82
## 22       2         3        11  10.52           0.25   0.20    3.14
## 23       2         3        12  35.09           1.42   0.21    5.77
## 24       2         3        13  13.45           1.03   0.23   16.96
## 25       2         3        14   6.45           1.02   0.18   30.28
## 26       2         4        15  38.52           3.90   0.28   52.98
## 27       2         4        16  35.09           1.39   0.23   24.60
## 28       2         4        17  58.01           6.06   0.26   74.25
## 29       2         4        18  17.90           6.97   0.27  124.09
## 30       2         4        19  23.00           4.30   0.25   75.06
## 31       2         4        20  15.60           1.05   0.21    9.69
## 32       2         4        21   6.45           4.10   0.27   21.27
## 33       2         4        22  20.37           1.18   0.16   12.97
## 34       2         4        23  13.45           1.44   0.15   17.08
## 35       2         4        24  35.09           1.77   0.24   32.63
attach(pcada)
pcada.pca <- prcomp(pcada[,c(4:7)], center = TRUE,scale. = TRUE)
summary(pcada.pca)
## Importance of components:
##                           PC1    PC2    PC3     PC4
## Standard deviation     1.5948 0.8536 0.7792 0.34750
## Proportion of Variance 0.6359 0.1822 0.1518 0.03019
## Cumulative Proportion  0.6359 0.8180 0.9698 1.00000
head(pcada.pca$rotation)
##                      PC1        PC2        PC3        PC4
## AB             0.4327979 -0.6705799  0.5591930 -0.2243029
## Peso.total..g. 0.5568117  0.1910096 -0.4666661 -0.6600749
## Grosor         0.4233414  0.6909108  0.5642964  0.1580942
## AF..cm.        0.5687080 -0.1909978 -0.3887099  0.6992822
library(devtools)
install_github("vqv/ggbiplot")
## Skipping install of 'ggbiplot' from a github remote, the SHA1 (7325e880) has not changed since last install.
##   Use `force = TRUE` to force installation
library(ggbiplot)
## Loading required package: ggplot2
## Loading required package: plyr
## Loading required package: scales
## Loading required package: grid
ggbiplot(pcada.pca)

pcs1<-ggbiplot(pcada.pca,ellipse=TRUE,groups=Parcela)
pcs1

pcs2<-ggbiplot(pcada.pca,choices=c(1,3),ellipse=TRUE,  groups=Parcela)
pcs2

pcs3<-ggbiplot(pcada.pca,choices=c(2,3),ellipse=TRUE,  groups=Parcela)
pcs3