Skip to contents

Check if pkg is installed. If not, package is installed with install.packages(dependencies = TRUE) and loaded with library(pkg, character.only = TRUE)

Usage

check_inst_pkg(pkg)

Arguments

pkg

name of package (a character vector)

Value

Package: 'name' loaded or Loading package: 'name'

Examples

check_inst_pkg("plotly")
#> Loading required package: plotly
#> Warning: there is no package called ‘plotly’
#> also installing the dependencies ‘httr’, ‘htmlwidgets’, ‘lazyeval’, ‘crosstalk’, ‘data.table’
#> Loading required package: ggplot2
#> 
#> Attaching package: ‘plotly’
#> The following object is masked from ‘package:ggplot2’:
#> 
#>     last_plot
#> The following object is masked from ‘package:stats’:
#> 
#>     filter
#> The following object is masked from ‘package:graphics’:
#> 
#>     layout