Skip to content

Instantly share code, notes, and snippets.

@chasemc
Created February 28, 2018 16:15
Show Gist options
  • Save chasemc/fc17bdd0b4914abca855efd5bb14ad6b to your computer and use it in GitHub Desktop.
Save chasemc/fc17bdd0b4914abca855efd5bb14ad6b to your computer and use it in GitHub Desktop.
Install some packages
if(!length(grep("mzR",row.names(installed.packages())))){
if(!length(grep("BiocInstaller",row.names(installed.packages())))){
source("https://bioconductor.org/biocLite.R")
biocLite("BiocInstaller",suppressUpdates = T)
}
source("https://bioconductor.org/biocLite.R")
biocLite("mzR",ask=F)
}
# Function to Install and Load R Packages
Install_And_Load <- function(Required_Packages)
{
Remaining_Packages <-
Required_Packages[!(Required_Packages %in% installed.packages()[, "Package"])]
if (length(Remaining_Packages))
{
install.packages(Remaining_Packages)
}
for (package_name in Required_Packages)
{
library(package_name,
character.only = TRUE,
quietly = TRUE)
}
}
# Required packages to install and load
Required_Packages = c("devtools","svglite","shinyjs", "mzR","plotly","colourpicker","shiny", "MALDIquant", "MALDIquantForeign","readxl","networkD3","ape","FactoMineR","dendextend","networkD3","reshape2","plyr","igraph")
# Install and Load Packages
Install_And_Load(Required_Packages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment