When running a script with new libraries, I will automatically respond to the error message Error in library(x) : there is no package called ‘x’ with install.packages("x"). Is there a way to automate this process?
Asked
Active
Viewed 1,013 times
1
kilojoules
- 9,768
- 18
- 77
- 149
1 Answers
2
if(! require("x")) install.packages("x")
but see Check if R package is installed then load library for more robust solutions
jaimedash
- 2,683
- 17
- 30