Given a package name, either as a string or object, load the package if it exists, else install it from CRAN and then load

GetPackage(package)

Arguments

package
A character vector of packages to load

Examples

GetPackage('gam')
Loading required package: gam
Loading required package: splines
Loading required package: foreach
foreach: simple, scalable parallel programming from Revolution Analytics Use Revolution R for scalability, fault tolerance and more. http://www.revolutionanalytics.com
Loaded gam 1.14