0

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
  • 8,814
  • 17
  • 70
  • 133

1 Answers1

1
if(! require("x")) install.packages("x")

but see Check if R package is installed then load library for more robust solutions

jaimedash
  • 2,543
  • 16
  • 29