I am trying to use a github package from a worked example. I used the suggested methods
here to get the install-github working
library(devtools)
library(httr)
set_config(config(ssl_verifypeer = 0L))
install.packages("install_github")
install_github("ggbiplot", "vqv")
I get a warning that redirects me to the R website
install page, and then error Error in parse_repo_spec(repo) : Invalid git repo specification: 'ggbiplot'
Ultimately, I want to run this piece of code
# Load data
data(iris)
log.ir <- log(iris[, 1:4])
ir.species <- iris[, 5]
#PCA
ir.pca <- prcomp(log.ir,
center = TRUE,
scale. = TRUE)
#Plot
g <- ggbiplot(ir.pca, obs.scale = 1, var.scale = 1,
groups = ir.species, ellipse = TRUE,
circle = TRUE)
g <- g + scale_color_discrete(name = '')
g <- g + theme(legend.direction = 'horizontal',
legend.position = 'top')
print(g)
You need the user/repo
syntax to specify the repo, since there are multiple packages called ggbiplot
on GitHub - the R package has 157 forks and you have to tell R which one you want:
library(devtools)
install_github('vqv/ggbiplot')
#> Downloading GitHub repo vqv/ggbiplot@HEAD
library(ggbiplot)
Now we can run your code:
data(iris)
log.ir <- log(iris[, 1:4])
ir.species <- iris[, 5]
#PCA
ir.pca <- prcomp(log.ir,
center = TRUE,
scale. = TRUE)
#Plot
g <- ggbiplot(ir.pca, obs.scale = 1, var.scale = 1,
groups = ir.species, ellipse = TRUE,
circle = TRUE)
g <- g + scale_color_discrete(name = '')
g <- g + theme(legend.direction = 'horizontal',
legend.position = 'top')
print(g)