r - 错误 : . onLoad 在 'tcltk' 的 loadNamespace() 中失败,详细信息 :call: fun(libname, pkgname)

标签 r adehabitathr

最近我在库包“adehabitat”时遇到了问题。我不知道我应该怎么做才能解决这个问题。任何人都可以知道并为我提供帮助吗?非常感谢。

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.2 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] ade4_1.7-2 sp_1.1-1  
loaded via a namespace (and not attached):
[1] tools_3.2.2     grid_3.2.2      lattice_0.20-33

> install.packages("adehabitat")
Installing package into ‘/Users/penghe/Library/R/3.2/library’
(as ‘lib’ is unspecified)
  There is a binary version available but the source version is later:
           binary source needs_compilation
adehabitat 1.8.17 1.8.18              TRUE
Do you want to install from sources the package which needs compilation?
y/n: n
trying URL 'https://mirrors.ustc.edu.cn/CRAN/bin/macosx/mavericks/contrib/3.2/adehabitat_1.8.17.tgz'
Content type 'application/octet-stream' length 2671207 bytes (2.5 MB)
==================================================
downloaded 2.5 MB
The downloaded binary packages are in
    /var/folders/qr/21mfb0t91rz475z2v8fs0c4w0000gn/T//Rtmphy4lRT/downloaded_packages

> library(adehabitat)
Loading required package: tkrplot
Loading required package: tcltk
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: X11 library is missing: install XQuartz from xquartz.macosforge.org
Error: package ‘tcltk’ could not be loaded

最佳答案

错误消息的关键部分是error: X11 library is missing

这发生在我对 GitHub 操作的 R 包检查中,通过将其添加到工作流程中解决了这个问题:

      - name: Install XQuartz on macOS
        if: runner.os == 'macOS'
        run: brew install xquartz --cask

在普通的 macOS 上,您可以简单地运行它来安装缺少的 xquartz:

brew install xquartz --cask

关于r - 错误 : . onLoad 在 'tcltk' 的 loadNamespace() 中失败,详细信息 :call: fun(libname, pkgname),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32447745/

相关文章:

rCharts 轴标签与刻度线标签重叠

r - 连接周期以获得时间序列,同时针对不同的起点

r - 在查询速度方面优化数据库设计以存储R中的矩阵

r - 使用 basename 捕获导致错误的文件名值的一部分

r - Betareg 导致内存分配问题