I am currently working on an assignment (using Windows 7 Professional machine) whereby I have to be using 'datasets' package within knitr document. Since I am trying to knit my document, I have to provide website to CRAN mirror as repo when using install.packages() command. Following is my chunk of my code:
list.of.packages <- c ('R.utils', 'googleVis', 'choroplethr', 'datasets', 'MASS')
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) {
install.packages(new.packages, repos="http://cran.rstudio.com/")
lapply (new.packages, require, character.only = TRUE)
} else {
lapply(list.of.packages, require, character.only = TRUE)
}
However, I get the following error:
Quitting from lines 13-16 (Preview-191015a600a.Rmd)
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: <Anonymous> ... withVisible -> eval -> eval -> install.packages -> contrib.url
Execution halted
If I remove 'datasets' from package list, the program runs without any issues. So, I tried looking for 'datasets' package on http://cran.rstudio.com/ website and did not find datasets package. I understand that this is the reason why my knitr is throwing an error.
However, I am surprised not to see 'datasets' package on the cran website. I am new to R, so am not sure if this has always been the case. I have tried looking for datasets package mirror all over the web, but to no avail.
Does anyone have link to datasets package repo on CRAN?
Appreciate your help!