//How install Multiple libraries in R?

## How install Multiple libraries in R?

Many times when executing a code, we have to install and load the necessary libraries for that it works correctly.

Today I want to show you a simple solution so that with just one function and three lines of code you can create a preload for your Apps.

For this we are going to create the loadapp function, in which we will include the following code:

loadApp <- function(){

#Cargamos las librerias que necesitamos
#We create a variable where we indicating that we select the ones that we do not have installed.
#With a loop we install the libraries that we do not have.
for(lib in install.lib) install.packages(lib,dependences=TRUE)
}

Now every time you want to load all the libraries of your application in a simple way, you just have to call this function, I hope it will help you.

loadApp()
## Loading required package: footballR
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
##     filter, lag
## The following objects are masked from 'package:base':
##
##     intersect, setdiff, setequal, union
## Loading required package: skellam
## Loading required package: ggplot2
## Loading required package: purrr
## Loading required package: tidyr
## footballR     dplyr   skellam   ggplot2     purrr     tidyr
##      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE

Summary
Article Name
How install Multiple libraries in R?
Description
How to create a script that load multiple libraries in R and check what libraries you don't have, you can use this script to help you to do this.
Author
Publisher Name
Blog-R
Publisher Logo