unable to load the libarary after successfully installed

I need to include some functions in plot3D. When I installed the package, it shows

install.packages("plot3D")
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/plot3D_1.4.tgz'
Content type 'application/x-gzip' length 2795822 bytes (2.7 MB)
==================================================
downloaded 2.7 MB

The downloaded binary packages are in
/var/folders/jt/fdvwy3jd70zgxp4z_f2213vr0000gn/T//RtmpEZwkQ4/downloaded_packages

But after that, when I try to load the library, it shows an error as the following:

library(plot3D)
Error: package or namespace load failed for ‘plot3D’:
.onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: X11 library is missing: install XQuartz from www.xquartz.org

How to solve the problem? Any idea?

Thanks in advance!

Just follow the instructions from the error message

1 Like

Thanks! I did try to install X11, but recieved this

install.packages("XQuartz", dependencies = TRUE)
Warning in install.packages :
package ‘XQuartz’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

Any idea?

Should I update R? I thought my R is already the lastest version.

XQuartz isn't an R package, it's a program for your macOS. You can download it from the XQuartz site:
https://www.xquartz.org/

1 Like

It works now! Thanks!