修正 R 包的版本 Fix the version of R packages

使用 install.packages() 函数安装 CRAN 包时,无法指定包的版本,因为预期会安装该包的最新版本,并且该版本应与其依赖项的最新版本兼容。When you use the install.packages() function to install CRAN packages, you cannot specify the version of the package, because the expectation is that you will install the latest version of the package and it should be compatible with the latest version of its dependencies. 如果你安装了过时的依赖项,则也会对其进行更新。If you have an outdated dependency installed, it will be updated as well.

有时,你需要修正 R 包的版本。Sometimes you want to fix the version of an R package. 有若干方法可实现此操作:There are several ways to do this:

使用库 UI 或 API 在群集的所有实例上安装 R 包时,建议你使用第三个选项。When you use the Libraries UI or API to install R packages on all the instances of a cluster, we recommend the third option.

Microsoft R 应用程序网络维护着一个 CRAN 时间机器,该机器每天晚上存储 CRAN 的快照。The Microsoft R Application Network maintains a CRAN Time Machine that stores a snapshot of CRAN every night. 快照可以在 https://cran.microsoft.com/snapshot/<date> 上获得,其中 <date> 是所需快照的日期(例如,2019-05-01)。The snapshots are available at https://cran.microsoft.com/snapshot/<date> where <date> is the date of the desired snapshot, for example, 2019-05-01. 若要安装 R 包的特定版本,请在创建库时将此 URL 指定为 CRAN 库的存储库。To install specific versions of R packages, specify this URL as the repository of your CRAN library when you create the library.