Error when including the zoo package in R - r

When I tried to include the zoo package, I received the following error information:
> library(zoo)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object
'/Users/zhangfan/Library/R/2.13/library/zoo/libs/i386/zoo.so':
dlopen(/Users/zhangfan/Library/R/2.13/library/zoo/libs/i386/zoo.so, 6):
Library not loaded: #rpath/R.framework/Versions/2.13/Resources/lib/libR.dylib
Referenced from: /Users/zhangfan/Library/R/2.13/library/zoo/libs/i386/zoo.so
Reason: image not found
Error: package/namespace load failed for 'zoo'
Could anyone explain what that means?
Thanks a lot!

I had the same error after trying to install zoo recently. I fixed it by installing from source.
install.packages("zoo", type="source", repos="http://cran.stat.ucla.edu/")

That looks a whole lot like the errors that Mac /User/'s were getting last week with the new GUI R.app that went along with R 2.14.0. Simon Urbanek fixed it several days ago, if those details fit your situation the first thing to try would be to install the new GUI from either CRAN or http://r.research.att.com/
If ion the other hand you are trying to install the new zoo-package from CRAN while running R 2.13.x you might want to upgrade R (at the same locations) to prevent major version mismatch.

Related

plot KML library load fail, unable to load shared object

Not sure if relevant, but I'm getting this error after a recent update to Mac OS Monterey Version 12.5.1.
After trying library(plotKML) I get the following:
Error: package or namespace load failed for ‘plotKML’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/kchalkowski/Library/R/x86_64/4.1/library/lwgeom/libs/lwgeom.so':
dlopen(/Users/kchalkowski/Library/R/x86_64/4.1/library/lwgeom/libs/lwgeom.so, 0x0006): Library not loaded: '/usr/local/opt/proj/lib/libproj.22.dylib'
I checked the directory /usr/local/opt/proj/lib and sure enough, libproj.22.dylib is not there. Rather, another version is there in it's place: libproj.25.dylib.
Is there a way to get that older version of libproj? or a way to link plotKML to the correct dylib? I had a similar issue with sf, but was able to fix it with a brew reinstall of pkg-config gdal proj geos in the terminal, and uninstalling and reinstalling sf. I've tried uninstalling and reinstalling plotKML but to no avail.
Did a search for the name of the dynamic library and I think I actually just fixed it following advice here: https://github.com/flow-project/flow/issues/896
I used the following in the terminal but instead of 19/5, I replaced the versions of the libraries in the code here with the one I have (25) and the one plotKML wants (22), and it seems to be working now?:
ln -s /usr/local/opt/proj/lib/libproj.19.dylib /usr/local/opt/proj/lib/libproj.15.dylib

rJava doesn't load in R 3.4.2 and MacOS Sierra 10.12.6

Here's the error I get:
> library(rJava)
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
I see this is by no means a unique problem.. I've tried the solutions here, here and here. No success.
Some more details: I'm using R GUI, but I also can't load rJava through R terminal. I also didn't have any issue with rJava on R 3.3.s
You have two options here:
get older release of R and use precompiled version of rJava
get rJava sources and compile it for yourself
Note that rJava (most recent sources) require some features that are not embedded inside XCode and clang that is available via AppStore. You will need to do some low level stuff when it comes to building rJava package.
You can find detailed instruction here: http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/
If you decide to use older release of R, it's still a struggle to get it working, but way less to do: http://www.owsiak.org/r-java-rjava-and-macos-adventures/
JAVA_HOME path is different for different version of MAC OS.
In some cases there is /jre folder and in some cases it is not after /Home director manually go towards /server folder with CD command in terminal and using pwd copy the entire path use that to set the java.home then you can easily load rJava library. This is how I was able to fix the issue
options("java.home"="/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/lib")
Sys.setenv(LD_LIBRARY_PATH='$JAVA_HOME/server')
dyn.load('/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/lib/server/libjvm.dylib')
library(rJava)

Installing & using the asbio package under OS X

I'm a TA in a statistics class, and the students are supposed to use the "asbio" package in r for multiple comparisons. Some of those who have OSX are complaining that asbio will not load. I cannot reproduce the error on my own mac.
Here are the errors one of the students is seeing:
>library(asbio)
Loading required package: tcltk
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /opt/X11/lib/libX11.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so
Reason: image not found
Error: package ‘tcltk’ could not be loaded
> install.packages("tcltk")
Warning in install.packages :
package ‘tcltk’ is not available (for R version 3.1.1)
Here are a few things students have tried:
install tcltk2: "It works now, but I still get errors" (Sorry, I know that's a confusing answer, but it's what I have)
install xquartz: "Now it works."
I suspect that xquartz is the right answer here, but if anybody could explain what's going on and confirm, that would be awesome.
(And why the ^& would a numerical statistics package need tcl/tk anyway???)
tcl/tk needs an X11 environment to work in for graphical output and Apple no longer ships an X11 environment with their operating system. XQuartz fills that gap, but is a separate install. Said install makes the X11 libraries available (look at the missing libraries in your errors) and those libraries—in turn—make graphical operations with tcl/tk possible.
the absio package has functions that let you do animation (like anim.ci) which rely on the graphics capabilities of tcl/tk.
A student in the class posted the following instructions:
1) Install xquartz. You don't need to click it ever again after installing it.
2) Restart computer.
3) Open Rstudio (or whatever R). Run library(tcltk). Don't use require or install.packages for it. Computer should now open up xquartz on its own.
4) Run install.packages("asbio")
5) library(asbio)
6) You should be able to run pairw.anova.
(I'm still waiting to see if the student wants credit by name here, but in any case, I'm thankful to them.)

Incompatible library version: libtk8.6.dylib requires ... when installing R package

I'm trying to install the R package ggplot2, though the error that I am getting seems unrelated to that specific package. I am running on Mac OSX 10.6.8. The error message is at the bottom of this message. What happened was:
I opened up R and typed install.packages("ggplot2"). After typing this, an X11 window opened saying that I should update to the latest version of X11. I clicked through and updated X11. The install went through fine, ending with a big green check mark.
Then, I thought, "let me check if R is up to date as well, as the ggplot documentation suggests updating R before installing ggplot". So I opened up R, and clicked "check for updates". Lo and behold! an update appeared. I downloaded and installed the update. The install went through fine, ending with a big green check mark.
When I opened R, I typed install.packages("ggplot2") and I got the message below:
> install.packages("ggplot2");
--- Please select a CRAN mirror for use in this session ---
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/tcltk.so, 10):
Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /usr/local/lib/libtk8.6.dylib
Reason: Incompatible library version: libtk8.6.dylib requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0
Your help is greatly appreciated. Thanks.
Try installing the latest version of XQuartz. It worked for me.

R and RGtk2 in OSX Mountain Lion

Has anybody succeeded in installing this lately? I am aware of an existing thread that addresses this, but I haven't been able to make it work. Also, it's from 2010 so maybe there's a more up-to-date approach?
Specifically, I have tried to work with these:
R version 3.0.1 (2013-05-16) -- "Good Sport"
RGtk2_2.20.25
cairoDevice_2.19
GTK_2.18.5-X11
echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/mysql/bin
echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig:
and following several instructions found online, but every time I try to:
R
>library(RGtk2)
I am always prompted with the error:
Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load
shared object
'/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RGtk2/libs/RGtk2.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RGtk2/libs/RGtk2.so,
6): Library not loaded:
/Library/Frameworks/GTK+.framework/Versions/2.24.X11/Resources/lib/libgtk-x11-2.0.0.dylib
Referenced from:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RGtk2/libs/RGtk2.so
Reason: image not found
Clues? Thanks a lot.
I solved it by installing GTK from http://r.research.att.com/libs/GTK_2.24.17-X11.pkg and XQuartz from https://www.xquartz.org/. Errors when loading rattle package can be solved in the same way.

Resources