Pre-Requirements
The next steps will require you to have docker.
what is docker?
For details on how to install and setup docker check out this page: https://docs.docker.com/
For Windows and Mac check out: https://www.docker.com/products/docker-toolbox
Running your RStudio
Let’s create a RStudio using Docker:
docker run -d -p 8790:8787 --name r_workbench it4poster/geofracker
##Open your browser at your docker host IP at port 8790
# Ususally for mac or windows: http://192.168.99.100:8790
# if you are using docker machine
# For linux user, usually: http://<your ip>:8790
# or: http://127.0.0.1:8790
At you your browser you will see a login page, for login use: User: rstudio Password: rstudio
Now execute the following to install some of the libs we will be using on our samples trough the blog:
#!/usr/bin/env Rscript
install.packages("rgeos")
install.packages("rgdal")
# raster install not working
install.packages('raster', repos='http://cran.us.r-project.org')
install.packages('ncdf4')
install.packages("xlsx")
install.packages("ggmap")
library(raster)
library(rgdal)
# installing dowload helper
## 1. install
install.packages("devtools")
library(devtools)
devtools::install_github("i40poster/geoSampaRHelper")
# using dowload helper
## 2 .Sample of use:
library(helper4geosampa)
# To conver GeoJSON
install.packages("geojsonio")
library("geojsonio")
# helper function to convert maps at the south hemisphere:
utm2decimalSouth <- function(data,zone,datum){
#coordinates(newData) <- c("easting","northing")
crs <- paste0("+proj=utm+zone=",zone,"+datum=",datum)
data@proj4string@projargs <- paste0("+proj=utm"," +south +zone=",zone," +datum=",datum)
spTransform(data, CRS("+proj=longlat"))}
Don’t worry rgdal has some OS dependencies, but your linux docker image has already it installeed for you.
For testing it just check out some of our posts in the blog.
comments powered by Disqus