当您尝试从GitHub的存储库安装一些R软件包时

install_github('rWBclimate', 'ropensci')

如果出现以下错误:
Installing github repo(s) rWBclimate/master from ropensci
Downloading rWBclimate.zip from https://github.com/ropensci/rWBclimate/archive/master.zip
Error in function (type, msg, asError = TRUE)  :
Could not resolve host: github.com; Host not found, try again

之所以显示此错误,是因为R尝试通过代理在Intenet上进行访问。

最佳答案



步骤1.安装devtools软件包

if (!require("devtools")) install.packages("devtools")
library(devtools)

步骤2.为我们的代理设置配置(请更新您的信息代理)
library(httr)
set_config(
  use_proxy(url="18.91.12.23", port=8080, username="user",password="password")
)
install_github('rWBclimate', 'ropensci')

09-05 03:18