执行停止 - 没有名为“rgeolocate”的包 [R]

Execution halted - no package called ‘rgeolocate’ [R]

我无法以 PDF 格式编织我的文档,因为我执行了以下操作:

setme <- 
"Sys.setenv(TZ='America/New_York') #some default not get any errors
invisible(loadNamespace('rgeolocate'))
invisible(loadNamespace('httr'))
mytz <- rgeolocate::ip_api(httr::content(httr::GET('https://api.ipify.org?format=json'))[1])[['timezone']]
Sys.setenv(TZ=mytz)"

cat(setme,file=file.path(R.home(),'etc/Rprofile.site'),sep='\n')

来自:https://community.rstudio.com/t/rstudio-sys-setenv-does-not-persist/2105/16

在 R Markdown 中,它打印以下消息:

Error in loadNamespace("rgeolocate") : 
  there is no package called ‘rgeolocate’
Execution halted

Do you know what is the reason for such message?

I regret having executed these lines. Thank you

安装 rgeolocate package from GitHub 而不是从 CRAN。

# install developmental version from GitHub
devtools::install_github( repo = "ironholds/rgeolocate" )

问题的部分答案来自@Steven Wink 对问题 Error in R: (Package which is only available in source form, and may need compilation of C/C++/Fortran) and @Hugues Fontenelle and his answer to the question Error in install.packages : type =="both" cannot be used with 'repos =NULL' 的回答。