【问题标题】:I get an error when trying to install dkahle/ggmap尝试安装 dkahle/ggmap 时出现错误
【发布时间】:2018-11-25 18:52:51
【问题描述】:

我厌倦了运行 install_github("dkahle/ggmap"),但是当我尝试安装 ggmap 时似乎出现了错误。

install.packages("devtools")
library(devtools)
install_github("dkahle/ggmap", ref = "tidyup")

这是我在运行 install_github 代码时在控制台中收到的错误消息。

Downloading GitHub repo dkahle/ggmap@tidyup
tar: Failed to set default locale
tar: Failed to set default locale
These packages have more recent versions available.
Which would you like to update?

1:   mime    (0.5   -> 0.6) [CRAN]
2:   openssl (1.0.2 -> 1.1) [CRAN]
3:   CRAN packages only
4:   All
5:   None

Enter one or more numbers separated by spaces, or an empty line to cancel
1: 5
v  checking for file '/private/var/folders/c2/98cb8xgx7m92m7x7g_ffthy00000gn/T/RtmpiOyVaS/remotes3326374be9c6/dkahle-ggmap-4dfe516/DESCRIPTION'
   During startup - Warning messages:
   1: Setting LC_CTYPE failed, using "C" 
   2: Setting LC_TIME failed, using "C" 
   3: Setting LC_MESSAGES failed, using "C" 
   4: Setting LC_MONETARY failed, using "C" 
-  preparing 'ggmap':
v  checking DESCRIPTION meta-information
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
   Removed empty directory 'ggmap/.github'
-  looking to see if a 'data/datalist' file should be added
-  building 'ggmap_2.7.904.tar.gz' (694ms)

Error: (converted from warning) Setting LC_CTYPE failed, using "C"
Execution halted
Error in i.p(...) : 
  (converted from warning) installation of package '/var/folders/c2/98cb8xgx7m92m7x7g_ffthy00000gn/T//RtmpiOyVaS/file332666bc795e/ggmap_2.7.904.tar.gz' had non-zero exit status

【问题讨论】:

    标签: r google-maps github geocode


    【解决方案1】:

    看起来像是 Mac 语言环境问题。

    在终端中运行defaults write org.R-project.R force.LANG en_US.UTF-8

    Source

    【讨论】:

    • 好像成功了;但它带来了另一个问题。我尝试使用来自 google 的 API 密钥运行 register_google(key = "my_api_key"),但出现错误“找不到函数“register_google””
    • 那你没有 ggmap 的 GitHub 版本。它是最新的 Github 版本的一部分,但不在 CRAN 上。
    • 如何获取 ggmap 的 GitHub 版本?
    • @Ola devtools::install_github("dkahle/ggmap", ref = "tidyup")(你需要安装devtools库)
    最近更新 更多