loading rgdal fails

andy.barbour's Avatar

andy.barbour

21 Oct, 2011 04:57 PM

Loading rgdal in RStudio fails, but not in the regular R environment. Any idea why? I've posted a question about this on stackoverflow (http://stackoverflow.com/questions/7852679/trouble-loading-rdgal-in...).

  1. Support Staff 2 Posted by Josh Paulson on 21 Oct, 2011 07:55 PM

    Josh Paulson's Avatar

    Andy,

    Not sure why this isn't working on your system, but I was able to get it working just fine. I noticed that you downloaded GDAL Complete from kyngchaos.com to install rgdal. Can you instead try the following method from within RStudio and let me know if it works.

    > setRepositories()
    1: 1 2
    > install.packages("rgdal")
    > library(rgdal)
    

    This is how I got it working. And just to be clear, after setRepositories(), you just type "1 2" and then press enter to enable the CRAN (extras) repository. If this doesn't work, can you check your log files:

    http://support.rstudio.org/help/kb/troubleshooting/rstudio-applicat...

    Josh

  2. 3 Posted by andy.barbour on 21 Oct, 2011 08:12 PM

    andy.barbour's Avatar

    Thanks, Josh.

    Your method works. I first had to remove the existing package directory, but then install.packages("rgdal") can complete its task, and library(rgdal) loads normally.

    I'm still confused why that might have happened. Ownership or permissions?

    Anyways, thanks again.

  3. Support Staff 4 Posted by Josh Paulson on 21 Oct, 2011 08:30 PM

    Josh Paulson's Avatar

    Andy,

    Glad that works, and not entirely sure why the other method caused problems. Looks like when you installed the GDAL framework it also put the package in that location /Library/Frameworks/GDAL.framework/Versions/1.8/Resources/gdal. Perhaps your path wasn't updated as when called from RStudio, it was searching in the wrong directory /Library/Frameworks/R.framework/Resources/lib/libgcc_s.1.dylib. Maybe updating .libPaths() would have done it, but not sure.

    Just for reference, on my end when installing from the CRAN (extras) repository it just put it in the standard library location: /Library/Frameworks/R.framework/Versions/2.13/Resources/library/rgdal/gdal.

    Let us know if anything else comes up though,

    Josh

  4. Josh Paulson closed this discussion on 25 Oct, 2011 11:48 AM.

Comments are currently closed for this discussion. You can start a new one.