Unable to load shared object

Hi everyone!
I'm trying to use R for a class. I am using MacOS Mojave 10.14.6 (18G3020).
For R, I installed:

  1. Microsoft Open R version 3.5.1
  2. RStudio
    I also read that I need to download compiler files to run R on my machine
    (Tools - R for Mac OS X - developer's page - GNU Fortan for Xcode) so per the link's instructions, I installed:
  3. Xcode
  4. GNU Fortran 8.2
  5. Mandatory Library tools
    -xz utils
    -pcre2
    -(disregarded bzip because my system is 10.14.6 isn't old)

I also installed Xquartz (XQuartz 2.7.11 (xorg-server 1.18.4)) for good measure and made it my default.

For my class, the library I need to load is 'quantmod'. The following happened after I installed it and tried to load the library. It seems like there's a problem with the object files in my library. Any suggestions? Thanks!

install.packages('quantmod')
trying URL 'https://mran.microsoft.com/snapshot/2018-08-01/src/contrib/quantmod_0.4-13.tar.gz'
Content type 'application/octet-stream' length 142084 bytes (138 KB)
==================================================
downloaded 138 KB

  • installing source package ‘quantmod’ ...
    ** package ‘quantmod’ successfully unpacked and MD5 sums checked
    ** R
    ** demo
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
  • DONE (quantmod)

The downloaded source packages are in
‘/private/var/folders/bm/wg7t4j8j3tz_88yfzyfdkkhm0000gn/T/Rtmp9k8puA/downloaded_packages’

library(quantmod)
Loading required package: TTR
Error: package or namespace load failed for ‘TTR’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5.1-MRO/Resources/library/curl/libs/curl.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5.1-MRO/Resources/library/curl/libs/curl.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/3.5.0-MRO/Resources/lib/libR.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5.1-MRO/Resources/library/curl/libs/curl.so
Reason: image not found
Error: package ‘TTR’ could not be loaded

Try installing the curl package

install.packages("curl")

installed curl that way

tried loading quantmod again and got this....corrupted?:

library(quantmod)
Loading required package: xts
Loading required package: zoo

Attaching package: ‘zoo’

The following objects are masked from ‘package:base’:

as.Date, as.Date.numeric

Loading required package: TTR
Error: package or namespace load failed for ‘TTR’ in get(method, envir = home):
lazy-load database '/Library/Frameworks/R.framework/Versions/3.5.1-MRO/Resources/library/curl/R/curl.rdb' is corrupt
Error: package ‘TTR’ could not be loaded
In addition: Warning message:
In get(method, envir = home) : internal error -3 in R_decompress1

Also, tried to load curl again afterwards to check it and got this:

library(curl)
Error: package or namespace load failed for ‘curl’ in get(method, envir = home):
lazy-load database '/Library/Frameworks/R.framework/Versions/3.5.1-MRO/Resources/library/curl/R/curl.rdb' is corrupt
In addition: Warning messages:
1: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4], :
restarting interrupted promise evaluation
2: In get(method, envir = home) :
restarting interrupted promise evaluation
3: In get(method, envir = home) : internal error -3 in R_decompress1

I restarted R and I think it cleared a lot up.

library(curl) produced no errors

And then when I invoked library(quantmod), this is what I got. Are the masked objects something to worry about?

library(quantmod)
Loading required package: xts
Loading required package: zoo

Attaching package: ‘zoo’

The following objects are masked from ‘package:base’:

as.Date, as.Date.numeric

Loading required package: TTR
Version 0.4-0 included new data defaults. See ?getSymbols.
Learn from a quantmod author: https://www.datacamp.com/courses/importing-and-managing-financial-data-in-r

Do you get any error message while installing? Have you restarted your R session between installations?

No error messages while installing curl.

I restarted my R session only after I saw the error produced from loading curl via library(curl).
Then after I restarted my R session, I was able to load curl via library(curl) with no problems.

My remaining question is: what do the messages about the objects being masked mean when I load quantmod via library(quantmod)?

It means there are functions from two different packages with the same name

So no problems would arise from this redundancy?

No, as long as you are aware of this, for example, if you want to use the base version of those functions you simply have to reference them explicitly, like this base::as.Date()

This is interesting. I hope to never come across needing to use these because I'm sure I'll forget. I'm happy to be able to use quantmod finally so I can actually learn in class.

Andre, thanks for all your patience in coaching me, the noob!

I'm glad to be of service

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.