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

时间:2022-04-04 23:54:42

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?

建议R用户从本地CRAN镜像下载R和R包。但有些已经过时了。有没有一种简单的方法可以检查存储库是否已过时? R中的任何功能都可以吗?

1 个解决方案

#1


6  

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
> 

#1


6  

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
>