Having issues with installing the 'geoR' package into my RStudio and R.

Hi there,

I'm attempting to install the geoR package into my RStudio (version 1.2.1335) and R Program (version 3.2.1), but I'm having issues I cannot resolve.

My attempts:
I first ran this line: 'install.packages("geoR")'. I then received the following option:

There is a binary version available but the source version is later:
binary source needs_compilation
geoR 1.7-5.2 1.7-5.2.1 TRUE

Do you want to install from sources the package which needs compilation?
y/n:

After choosing 'y', it returns the following:
installing the source package ‘geoR’

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 404k 100 404k 0 0 651k 0 --:--:-- --:--:-- --:--:-- 652k
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2019a.1.0/zoneinfo/America/Los_Angeles'

  • installing source package ‘geoR’ ...
    ** package ‘geoR’ successfully unpacked and MD5 sums checked
    ** libs
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    ERROR: compilation failed for package ‘geoR’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/geoR’
    Warning in install.packages :
    installation of package ‘geoR’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/b4/4c4r41s12m1f1627q_vbqth00000gn/T/RtmpUl3tPf/downloaded_packages’

If I choose 'n', I get the following:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 100 1026k 100 1026k 0 0 1325k 0 --:--:-- --:--:-- --:--:-- 1324k

The downloaded binary packages are in
/var/folders/b4/4c4r41s12m1f1627q_vbqth00000gn/T//RtmpUl3tPf/downloaded_packages

Then in the bottom right 'packages' window, I check on the box right next to 'geoR' to install, and then get the following output:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
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.2/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /usr/X11/lib/libX11.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/tcltk/libs/tcltk.so
Reason: image not found
In addition: Warning messages:
1: package ‘geoR’ was built under R version 3.2.5
2: running command ''/usr/bin/otool' -L '/Library/Frameworks/R.framework/Resources/library/tcltk/libs//tcltk.so'' had status 1
Error: package or namespace load failed for ‘geoR’

Any suggestions, feedback is much appreciated!

You need to have xcode installed in your system for compiling packages on MacOS

xcode-select --install

Here are some installation instructions

Also, you are using a very old version of R, this is going to bring you a lot of troubles for installing packages, I recommend you to update R, current version is 3.6.0

https://cran.r-project.org/bin/macosx/

2 Likes

Thank you!!

I followed your suggestion and was able to install the geoR package. It turned out that I also had to install the XQuartz, but I was figured that out easily.

I do have one more question, if you know:
I also need to install the 'gstat' package. I had no problem installing this one. However, when I made the attempt to use the 'coordiantes()' function—which I believe is from that 'gstat' package?—I get a 'could not find function' error.

Copy/Paste of that command line:

install.packages("gstat")
trying URL 'https://cran.cnr.berkeley.edu/bin/macosx/el-capitan/contrib/3.6/gstat_2.0-1.tgz'
Content type 'application/x-gzip' length 2485135 bytes (2.4 MB)
==================================================
downloaded 2.4 MB

The downloaded binary packages are in
/var/folders/b4/4c4r41s12m1f1627q_vbqth00000gn/T//RtmpvfWYyK/downloaded_packages

library(gstat)
coordinates(a)
Error in coordinates(a) : could not find function "coordinates"
coordnames-methods
Error: object 'coordnames' not found
coordinates()
Error in coordinates() : could not find function "coordinates"

Any suggestions?

The error message is self explanatory, coordinates() is not part of the gstat package, maybe you are looking for the sp::coordinates(), I can't know for sure since you are not providing information about the functionality you are looking for.

I have this in my worksheet:

library(gstat)
coordinates(a) <- ~x+y
class(a)
bubble(a, "lead", main="Lead concentration (ppm)")
bubble(a, "zinc", main="Zinc concentration (ppm)")

I'm attempting to replicate the R commands in the screenshot below:

In your example geoR is loaded first, that package imports sp so most likely you are looking for sp::coordinates(), have in mind that you have to load all the packages you want to use on each new R session.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.