Skip to content

Instantly share code, notes, and snippets.

@pmur002
pmur002 / gist:c250e177c0da896f10970f6c66763e4a
Created Oct 29, 2018
Lines between maps on multiple-map layout
View gist:c250e177c0da896f10970f6c66763e4a
## Main code based on https://www.r-spatial.org//r/2018/10/25/ggplot2-sf-3.html
library("ggplot2")
theme_set(theme_bw())
## Requires up to date gdal
## (e.g., from https://launchpad.net/~ubuntugis/+archive/ubuntu/ppa)
library("sf")
library("rworldmap")
library("rworldxtra")
@pmur002
pmur002 / ensurePkg.xml
Last active Aug 29, 2015
Define a module wrapper for ensurePkg.R gist
View ensurePkg.xml
<?xml version="1.0"?>
<module xmlns="http://www.openapi.org/2014/">
<platform name="R"/>
<output name="ensurePkg" type="internal"/>
<output name="ensurePkgGitHub" type="internal"/>
<source ref="https://gist.githubusercontent.com/pmur002/922c97dd9245c9a0cf4c/raw/534d28fc62be6396fce0318e0b9b489b1142ba26/ensurePkg.R"><![CDATA[]]></source>
</module>
@pmur002
pmur002 / ensurePkg.R
Last active Aug 29, 2015
Define a function that installs an R package if it is not available
View ensurePkg.R
ensurePkg <- function(x, lib.loc=NULL) {
if (is.null(lib.loc)) {
home <- Sys.getenv("HOME")
if (nchar(home)) {
lib.loc <- file.path(home, ".OA.Rlibs")
} else {
lib.loc <- "./.OA.Rlibs"
}
if (!file.exists(lib.loc))
dir.create(lib.loc)