I am attempting to install and use the 'OpenStreetMaps' package in RStudio. When I download the package, a successful message appears to state that:
> install.packages("OpenStreetMap", dependencies = T)
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/HP/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/4.0/OpenStreetMap_0.3.4.zip'
Content type 'application/zip' length 2264482 bytes (2.2 MB)
downloaded 2.2 MB
package ‘OpenStreetMap’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\HP\AppData\Local\Temp\RtmpiKko3B\downloaded_packages
However, when I attempt to load the package into my library, an error message appears regarding an rJava corruption:
> library(OpenStreetMap)
Error: package or namespace load failed for ‘OpenStreetMap’ in get(Info[i, 1], envir = env):
lazy-load database 'C:/Users/HP/Documents/R/win-library/4.0/rJava/R/rJava.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
I have installed and loaded the 'rJava' package in an attempt to resolve this issue though this does not seem to change anything. Please can some advise on how I am able to install and run the functions in the 'OpenStreetMaps' package?
Kind regards,
Stevie P
Do you get any error or warning message when installing rJava? If not, do you get any error or warning messages when loading rJava?
Thank you for replying!
No error or warning messages appear when installing rJava as shown below:
> install.packages('rJava')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/HP/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/4.0/rJava_1.0-4.zip'
Content type 'application/zip' length 1127320 bytes (1.1 MB)
downloaded 1.1 MB
package ‘rJava’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\HP\AppData\Local\Temp\RtmpiKko3B\downloaded_packages
But when I attempt to load 'rJava', an error message does appear. Please see below:
> library(rJava)
Error: package or namespace load failed for ‘rJava’ in get(Info[i, 1], envir = env):
lazy-load database 'C:/Users/HP/Documents/R/win-library/4.0/rJava/R/rJava.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1
Hope to hear your reply soon @andresrcs
Kind regards,
Stevie P
Can you try the following?
Manually remove the folder where rJava is installed, check what Java version you have installed in your system (it has to match R's architecture) and set your JAVA_HOME variable accordingly in a .Renviron or Renviron.site startup file.
'JAVA_HOME'="C:/Program Files/Java/your_java_folder/"
Restar your R session (if you can restart your computer that would be better) and install rJava again.