6 Installing packages
All of the functions used up to this point were part of base R. They are built into the R language itself. Base R is extremely powerful, but R is also extensible. There are thousands of packages available for R.
The difficulty of installing these packages varies greatly. When possible, it is convenient to use Bioconductor, a repository of free open source R software for bioinformatics, which is updated twice a year, and includes stable versions of R packages that are useful for biological and data science projects.
Bioconductor itself has an R package that manages installation and updates of the software contained in the repository.
if (!("BiocManager" %in% rownames(installed.packages()))){
install.packages("BiocManager")
}
if (!("ggplot2" %in% rownames(installed.packages()))){
BiocManager::install("ggplot2")
}
if (!("tidyr" %in% rownames(installed.packages()))){
BiocManager::install("tidyr")
}
if (!("dplyr" %in% rownames(installed.packages()))){
BiocManager::install("dplyr")
}
if (!("magrittr" %in% rownames(installed.packages()))){
BiocManager::install("magrittr")
}
if (!("viridis" %in% rownames(installed.packages()))){
BiocManager::install("viridis")
}