1

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?

kilojoules
  • 9,768
  • 18
  • 77
  • 149

1 Answers1

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