ggplot2 sourcing error: X11 library is missing

2020-07-13 01:21发布

I'm trying to load ggplot2 library for R.

1) I've installed ggplot2 by this command. It was installed with no errors

install.packages('ggplot2', dependencies = TRUE)

2) Then i'm trying to use

library(ggplot2)

and get an error

Error : .onLoad не удалось в loadNamespace() для 'tcltk', подробности: вызов: fun(libname, pkgname) ошибка: X11 library is missing: install XQuartz from xquartz.macosforge.org Ошибка: не удалась загрузка пакета или пространства имен для ‘ggplot2’

3) Now i try to install XQuartz library by

install.packages("XQuartz")

and get this

Warning in install.packages : package ‘XQuartz’ is not available (for R version 3.1.2)

My R version 3.1.2 OS X Yosemite 10.10.2

Can you help me in installing ggplot2 pls?

4条回答
虎瘦雄心在
2楼-- · 2020-07-13 01:38

I got the same error message about the missing library.

Nowadays, a lot of libraries can be installed with Homebrew. For this instance it would be:

brew cask install xquartz
查看更多
叼着烟拽天下
3楼-- · 2020-07-13 01:38

Nothing worked for me but uninstalling Rstudio and then re-installing R and RStudio. Able to install and use packages now. Follow : To install R : https://cran.rstudio.com/ To install R studio : https://www.rstudio.com/

查看更多
Ridiculous、
4楼-- · 2020-07-13 01:43

R opens graphics windows using the standard X11 library on Macs, which is no longer part of the standard MacOS. When you try running programs that open a graphics window, you will get a message: "Error in check_for_XQuartz(): X11 library is missing: install XQuartz from xquartz.macosforge.org" and it should work

查看更多
姐就是有狂的资本
5楼-- · 2020-07-13 01:46

The OS update deleted the /usr/X11 and /usr/X11R6 symlinks. I had to just re-install XQuartz from macosforge which will setup the symlinks again.

查看更多
登录 后发表回答