library(devtools)
## Loading required package: usethis
install_github("vqv/ggbiplot")
## Skipping install of 'ggbiplot' from a github remote, the SHA1 (f7ea76da) 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 #see the official introduction to this library
data <- read.csv("Bakersfield_Grocery1.csv", header=TRUE, row.names=1)
site.groups <- c(rep("a", 3), rep("b", 3),
rep("c", 3))
data.pca <- prcomp(data[,-1], scale. = TRUE)
data.pca <- prcomp(data, scale. = TRUE)
ggbiplot(data.pca, labels = rownames(data))

g1 <- ggbiplot(data.pca, obs.scale = 1, var.scale = 1,
groups = site.groups,
ellipse = TRUE, circle = TRUE, labels = rownames(data))
g1 <- g1 + scale_color_discrete(name = '')
g1 <- g1 + theme(legend.direction = 'horizontal',
legend.position = 'top')
print(g1)

library(devtools)
install_github("vqv/ggbiplot")
## Skipping install of 'ggbiplot' from a github remote, the SHA1 (f7ea76da) has not changed since last install.
## Use `force = TRUE` to force installation
library(ggbiplot)
?ggbiplot #see the official introduction to this library
data <- read.csv("Bakersfield_Grocery2.csv", header=TRUE, row.names=1)
site.groups <- c(rep("a", 3), rep("b", 3),
rep("c", 3))
data.pca <- prcomp(data[,-1], scale. = TRUE)
data.pca <- prcomp(data, scale. = TRUE)
ggbiplot(data.pca, labels = rownames(data))

g1 <- ggbiplot(data.pca, obs.scale = 1, var.scale = 1,
groups = site.groups,
ellipse = TRUE, circle = TRUE, labels = rownames(data))
g1 <- g1 + scale_color_discrete(name = '')
g1 <- g1 + theme(legend.direction = 'horizontal',
legend.position = 'top')
print(g1)
