方法1.手动下载
用于离线环境安装R包:
download.packages(c("forecast"), "E:/Rpackages/forecast2/",type="win.binary")
PS:注意不同系统的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.覆盖
在有网络的地方,正常安装,然后在以路径安装好的包,复制到目标的离线环境中。
C:\Program Files\R\R-3.4.2\library
若果是RStudio安装的包,则默认在
C:\Users\{UserName}\Documents\R\win-library\3.4