View gist:c250e177c0da896f10970f6c66763e4a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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") |
View ensurePkg.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
View ensurePkg.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |