2

I want to automatically check and update packages every day. For this purpose, I've written few lines below which runs smoothly when I execute it in my RStudio.

options(install.packages.compile.from.source = "always")
update.packages(ask = FALSE, dependencies = TRUE)

Then I scheduled this mini script with taskscheduleR package to run daily. The scheduled job is succesfully called to be executed but is being halted and logs the below error:

Error in contrib.url(repos, type) : 
  trying to use CRAN without setting a mirror
Calls: update.packages -> available.packages -> contrib.url
Execution halted

What do I need to add in order to make it execute?

TylerH
  • 20,799
  • 66
  • 75
  • 101
nba2020
  • 618
  • 1
  • 8
  • 22

1 Answers1

2

add this to specify CRAN mirror:

options(repos = c(CRAN = "http://cran.rstudio.com"))

Does it work now?

JacobJacox
  • 917
  • 5
  • 14