简体   繁体   English

如何检查CRAN镜像是否过时?

[英]How to check if a CRAN mirror is outdated?

R users are advised to download R and R packages from local CRAN mirrors. 建议R用户从本地CRAN镜像下载R和R包。 But some are outdated. 但有些已经过时了。 Is there an easy way to check if a repository is outdated? 有没有一种简单的方法来检查存储库是否已过时? Any function in R that does that? R中的任何功能都可以吗?

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. 一种方法是查看$ CRANMIRROR / src / contrib并按日期排序(通过在日期单击两次),以便您可以比较镜像上最新的主程序包所包含的内容。

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). 除此之外,您可以使用R本身并在主服务器和镜像服务器上指向available.packages() - 如果结果集不同则可能存在问题(或者您在主服务器更新和镜像之间达到了点)。

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
> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM