ggplot2 sourcing error: X11 library is missing - r

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?

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.

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
Newer users of Homebrew may need this command:
brew install --cask xquartz

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

Related

I can't install the zenplots package in R?

I am having difficulty installing the zenplots package in R. For some odd reason when I use install.packages('zenplots') on my machine (Mac OS Catalina V-10.15.7) it installs fine... but when I try and install it on my second machine (also Mac OS Catalina V-10.15.7) and if I try and install it on my institutes server I get the following error:
Warning in fun(libname, pkgname) : couldn't connect to display ":0"
Error : package or namespace load failed for ‘loon’: .onLoad failed
in loadNamespace() for 'loon', details: call:
structure(.External(.C_dotTcl, ...), class = "tclObj") error: [tcl]
couldn't connect to display ":0".
Error: unable to load R code in package ‘zenplots’ Execution halted
I have also tried to install directly from GitHub using remotes::install_github('great-northern-diver/zenplots', force = T) but I get the same error as above.
I have even tried using install.packages("zenplots", repos="http://R-Forge.R-project.org") which works but unfortunatley this version doesn't contain all the functions found in zenplots.
My R version is above version 3.4.0, which is required for zenplots and as per the documentation I have already installed the graph package from BioConductor.
Any suggestions as to what might be the issue here?
I would guess that the R on your server was compiled without some feature required by the library. My guess: it is missing either tcltk or X11 support. To check do the following:
capabilities()
And see which features return FALSE, meaning they are not enabled.

Can't install TTR (tseries) R 3.3.3 (on debian stretch)

I'm unable to install the tseries package into R version 3.3.3 (on Debian debian stretch 4.9.0-6) because of its dependence on TTR. When I run the install, it tries to compile TTR, which leads to the error message
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/moi/R/x86_64-pc-linux-gnu-library/3.3/curl/libs/curl.so':
/usr/lib/x86_64-linux-gnu/libcurl.so.4:version `CURL_OPENSSL_4' not found (required by /home/moi/R/x86_64-pc-linux-gnu-library/3.3/curl/libs/curl.so)
I did try installing a binary version of TTR using
install.packages("TTR", repos="http://R-Forge.R-project.org")
But that yield the error message package ‘TTR’ is not available (for R version 3.3.3)
The problem appears to be related a request for CURL_OPEN_SSL_4 from the R library curl.so. Since I have libcurl.so.4 installed, I don't understand what the problem is.
I'd appreciate any thoughts on how to resolve this.
thanks
I happen to (also) maintain r-cran-ttr for Debian and here is what I have in my Build-Depends in file debian/control:
Build-Depends: debhelper (>= 7.0.0), r-base-dev (>= 3.4.3), cdbs, \
r-cran-xts (>= 0.10-0), r-cran-zoo, r-cran-curl
So it looks like your r-cran-curl package needs re-installing. You may have the libcurl.so as a run-time dependency (from one or more packages, this is commonly used library) but to compile you need the built-time dependency commonly supplied by the matching -dev package.
So maybe try installing sudo apt-get install libcurl4-openssl-dev, then install package curl from CRAN and once that is there, install TTR from CRAN or R-Forge (which is likely a source install anyway).

installation of package ‘RCurl’ had non-zero exit status

I am trying to install RCurl on OS X 10.12.6 but get the following error:
Error: package or namespace load failed for ‘RCurl’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/nick/Library/R/3.4/library/RCurl/libs/RCurl.so':
dlopen(/Users/nick/Library/R/3.4/library/RCurl/libs/RCurl.so, 6): Library not loaded: #rpath/libcurl.4.dylib
Referenced from: /Users/nick/Library/R/3.4/library/RCurl/libs/RCurl.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/nick/Library/R/3.4/library/RCurl’
The downloaded source packages are in
‘/private/var/folders/hx/9xx9fwq91t95k45dzlmzxfy40000gp/T/Rtmp14zSi1/downloaded_packages’
Warning message:
In install.packages("RCurl") :
installation of package ‘RCurl’ had non-zero exit status
This error has been discussed a bit already, but the solutions are all specific to linux and I don't think they are relevant to OS X. I did try installing the homebrew version of curl but that didn't help.
Any ideas? I think that more debugging information would be helpful, but I'm not sure what else to provide.
Thanks in advance!
Nick
If someone face the same problem in Ubuntu just as I do, the solution is run first in terminal:
sudo apt-get install libcurl4-gnutls-dev
Then in R:
install.packages('RCurl')
Looks like it's expecting libcurl.4.dylib in your #rpath.
I think others have encountered the same issue so the solution should be in here somewhere:
brew unlink R solution
Install curl again
In case it is useful for anyone else with this issue, I solved it without having to install the cran binary of R. (I use the homebrew version because it allows you to use faster BLAS options that take advantage of parallelism). Steps were:
Make sure that R doesn't find the homebrew or anaconda versions of curl-config (this will only affect the current R session)
PATH=/usr/bin/:$PATH
Download and install latest version of RCurl from http://www.omegahat.net/RCurl/ (replace <RCURLVERSION> with the current latest version)
wget http://www.omegahat.net/RCurl/RCurl_<RCURLVERSION>.tar.gz
R CMD INSTALL RCurl_<RCURLVERSION>.tar.gz

R rgl package error while loading the library

My system environment:
Mac OS 10.10.2
X11 (XQuartz 2.7.5)
R 3.1.2
When I load and use 'rgl' package, I get following error message.
> library("rgl",lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library")
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: In fun(libname, pkgname) : error in rgl_init
> plot3d(x,y,z)
Error in rgl.open(useNULL) : rgl.open failed
What's the problem?
I was already using rstudio when I got this warning. This seemed to work for me as suggested on https://cran.r-project.org/web/packages/shinyRGL/README.html.
I ran this on R console options(rgl.useNULL=TRUE)
I restarted the session using .rs.restartR()
Loaded the library again: library("plot3Drgl")
HTH ...
rgl appears to be working with RStudio. I'd make sure you have XQuartz installed on your system https://xquartz.macosforge.org/landing/ as X11 is no longer included with OS X by default. Let us know if it's still not working for you.
Start XQuartz before loading the rgl package. rgl displays images in an XQuartz window, but it does not seem to be able to open a RGL device window from within R when XQuartz is not already running. This works with Mac OS 10.11.3, XQuartz 2.7.8, R 3.2.3.
Detection of XQuartz on Mac OS is a little flaky. The latest rgl (version 0.95.1456) on R-forge might do better.

How to install tcltk in R?

My system is: debian6 + r-2.15.
I have installed tcl-devel and tk-devel with apt-get:
apt-get install tcl8.5-dev tk8.5-dev
But I'm getting the following error
> library("tcltk")
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: Tcl/Tk support is not available on this system
In addition: Warning message:
S3 methods ‘$.tclvar’, ‘$<-.tclvar’, ‘as.character.tclObj’, ‘as.character.tclVar’,
‘as.double.tclObj’, ‘as.integer.tclObj’, ‘as.logical.tclObj’, ‘as.raw.tclObj’,
‘print.tclObj’, ‘[[.tclArray’, ‘[[<-.tclArray’, ‘$.tclArray’, ‘$<-.tclArray’,
‘names.tclArray’, ‘names<-.tclArray’, ‘length.tclArray’, ‘length<-.tclArray’,
‘tclObj.tclVar’, ‘tclObj<-.tclVar’, ‘tclvalue.default’, ‘tclvalue.tclObj’,
‘tclvalue.tclVar’, ‘tclvalue<-.default’, ‘tclvalue<-.tclVar’, ‘close.tkProgressBar’ were declared in NAMESPACE but not found
Error: package/namespace load failed for ‘tcltk’
> install.packages('tcltk')
Warning message:
package ‘tcltk’ is not available (for R version 2.15.1)
How can I install tcltk in my R?
Edit
> capabilities()["tcltk"]
tcltk
FALSE
I compiled R-2.15.1 to install it on debian6.04, but how can I do now in order to run tcltk?
I think you are doing this wrong.
Read the README at http://cran.r-project.org/bin/linux/debian/ to learn how to get the current R version for your Debian version (be it stable or testing). This version already has support for the tcltk package which comes with R, provided R is built the right way. Which is easiest to assure with a proper pre-built version.
You can check that by looking at capabilities():
R> capabilities()["tcltk"]
tcltk
TRUE
R>
I ran the following code on centos, You need to modify it according to your system.
First, install tcl and tk:
# on centos
sudo yum install tcl-devel tcl
sudo yum install tk-devel tk
Second, compile R with --with-tcltk:
./configure --enable-R-shlib=yes --prefix=`pwd` --with-x=no --with-tcltk
Third, install package.

Resources