方法1.手動(dòng)下載
用于離線環(huán)境安裝R包:
download.packages(c("forecast"), "E:/Rpackages/forecast2/",type="win.binary")
PS:注意不同系統(tǒng)的R包格式不一樣。 Possible values of type are (currently) "source", "mac.binary", "mac.binary.el-capitan" and "win.binary": the appropriate binary type where supported can also be selected as "binary".
方法2.覆蓋
在有網(wǎng)絡(luò)的地方,正常安裝,然后在以路徑安裝好的包,復(fù)制到目標(biāo)的離線環(huán)境中。
C:\Program Files\R\R-3.4.2\library
若果是RStudio安裝的包,則默認(rèn)在
C:\Users\{UserName}\Documents\R\win-library\3.4