修正 R 套件 的版本 Fix the version of R packages

當您使用install. package ()函式來安裝 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.