Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a CRAN mirror is outdated?

Tags:

r

cran

R users are advised to download R and R packages from local CRAN mirrors. But some are outdated. Is there an easy way to check if a repository is outdated? Any function in R that does that?

like image 497
ggg Avatar asked Jun 02 '10 02:06

ggg


People also ask

Does it matter which CRAN mirror to use?

It doesn't really matter which CRAN mirror you select, but I selected one at the University of Kansas. The download will proceed faster if you choose a nearby location.

What is the best CRAN mirror for R?

If you are downloading R from CRAN, the following CRAN mirrors support HTTPS and we recommend using one of them: CRAN master (Austria): https://cran.r-project.org/ RStudio (USA): https://cran.rstudio.com/ Revolution Analytics (USA): https://cran.revolutionanalytics.com/


1 Answers

One way is to look at $CRANMIRROR/src/contrib and sort by date (by clicking twice on date) so that you can compare the most recent package on the mirror on what the master host carries.

Beyond that, you could use R itself and point available.packages() at the master as well as at a mirror -- if the result sets are different there may be an issue (or you hit the point between master update and mirroring).

Here is a quick example:

> main <- available.packages("http://cran.r-project.org/src/contrib", 
+                            method="wget")
> usmirror <- available.packages("http://cran.us.r-project.org/src/contrib", 
+                                method="wget")
> nrow(main)
[1] 2381
> nrow(usmirror)                 ## so the US mirror is 2 packages behind
[1] 2379
> setdiff(rownames(main), rownames(usmirror))    
[1] "ProbForecastGOP" "semPLS"   ## and these are the two
> 
like image 109
Dirk Eddelbuettel Avatar answered Sep 20 '22 14:09

Dirk Eddelbuettel