Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(58) installation instructions #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gmapsdistance
![](https://img.shields.io/badge/license-GPL--3-brightgreen.svg?style=flat)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/gmapsdistance)](https://cran.r-project.org/package=gmapsdistance)

***Interface Between R and Google Maps ***
***Interface Between R and Google Maps***



Expand All @@ -31,6 +31,17 @@ install.packages("gmapsdistance")

```

#### XML-package dependency
`XML` package seems to have been removed from CRAN. `gmapsdistance` depends on it, thus the above installation would fail for R 3.5 and above.

##### Workaround
```R
install.packages("XML", repos = "http://www.omegahat.net/R")
```

##### Dockerfile
A clean installation including all necessary dependencies can be found in a Dockerfile, which has been tested and should work. See `example_install.dockerfile`.


## Example 1
In this example we will compute the driving distance between Washington DC, and New York City. The code returns the `Time`, the `Distance` and the `Status` of the query (`OK` if it was successful).
Expand Down
29 changes: 29 additions & 0 deletions example_install.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:20.04
RUN apt update

# ------ Getting Latest R ------
# https://linuxize.com/post/how-to-install-r-on-ubuntu-20-04/

# base packages
RUN apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common -y

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
RUN add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'

RUN apt install r-base -y
RUN R --version

# XML-parsing back-end for R-XML
RUN apt install libxml2-dev -y

# XML-package in R got discontinued, but here's a workaround
RUN R -e 'install.packages("XML", repos = "http://www.omegahat.net/R")'

# We will also need curl
RUN apt install libcurl4-gnutls-dev -y

# with all the above, this should work
RUN R -e 'install.packages("gmapsdistance")'

# test
RUN R -e 'library(gmapsdistance)'