Install udunits2 package for R3.3
I have installed the udunits2
package in R on the Linux platform (redhat) without Internet connnection.
I also had this problem.
Firstly, I installed the udunits2
(not the R package udunits2)in the Linux example at (/usr/include/udunits2
).
Secondly, running this command worked:
install.packages("udunits2_0.13.tar.gz",configure.args='--with-udunits2-include=/usr/include/udunits2')
I hope this experience could help you.
I had the same problem. Following the first answer from here you have to install -dev
version of udunits
:
sudo apt-get install libudunits2-dev
Then the installation of udunits2
and ggforce
goes without any error.
EDIT:
Following the comments below, for CentOS7 it should be:
sudo yum install udunits2-devel
And for MacOS:
brew install udunits
This won't be any help to the chap that asked the question, but I was just having the same issue on a computing cluster without root access and the following worked:
homedir <- Sys.getenv("HOME")
udunits_dir <- file.path(Sys.getenv("HOME"), "udunits")
system(paste0("mkdir ", udunits_dir))
system(paste0("wget --directory-prefix=", udunits_dir, " ftp://ftp.unidata.ucar.edu/pub/udunits/udunits-2.2.25.tar.gz"))
owd <- getwd()
setwd(udunits_dir)
system("tar xzvf udunits-2.2.25.tar.gz")
setwd(file.path(udunits_dir, "udunits-2.2.25"))
system(paste0("./configure --prefix=", udunits_dir, "/local"))
system("make")
system("make install")
setwd(owd)
Sys.setenv(LD_LIBRARY_PATH=paste0(Sys.getenv("LD_LIBRARY_PATH"), ":", udunits_dir, "/local/lib"))
install.packages("udunits2",
type = "source",
configure.args = c(paste0("--with-udunits2-include=", udunits_dir, "/local/include"),
paste0("--with-udunits2-lib=", udunits_dir, "/local/lib")),
repos = "http://cran.rstudio.com")
dyn.load(paste0(udunits_dir, "/local/lib/libudunits2.so.0"))
install.packages("units", repos = "http://cran.rstudio.com",
configure.args = c(paste0("--with-udunits2-include=", udunits_dir, "/local/include"),
paste0("--with-udunits2-lib=", udunits_dir, "/local/lib")))