- 1) Environmental data: MAT, MAP, Temp Seasonality, Precip Seasonality, Elevation, PET
- 2) Distances between plots (Priority Level 1)
- 3) Area + Perimeter of islands (P/A ratio) (Priority Level 3)
- 4) Anthropogenic disturbance (road density, change in land cover, human population density) (Priority Level 2)
- 5) Isolation metrics for islands (Priority Level 3)
- 6) Hawaii only: substrate age (Priority Level 1)
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
# ====================================================================================== | |
# Confidence bands and setting order of line types in legend - ggplot | |
# ====================================================================================== | |
library(ggplot2) | |
# ========== create some data | |
my.data <- data.frame(time = rep(1:10,2), | |
means = 2:21, | |
lowerCI = 1:20, |
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
# ====================================================================================== | |
# Manually add confidence lines and setting order of line types in legend - ggplot | |
# The lower and upper values could be computed through bootstrapping. | |
# ====================================================================================== | |
library(ggplot2) | |
# create some data | |
my.data <- data.frame(time = rep(1:10, 2), | |
means = 2:21, |
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
# ====================================================================================== | |
# Pacific centered world map with ggplot | |
# Enhanced aspect with graticules and labels | |
# The central/prime meridian can be shifted with any positive value towards west | |
# Can use any project of known PROJ.4 string | |
# ====================================================================================== | |
# ~~~~~~~~~~~ Load needed libraries ~~~~~~~~~~~ # | |
library(data.table) | |
library(ggplot2) |
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
# =================================================================================== | |
# Test case - Shift central/prime meridian | |
# Fails concave polygons and closure of split polygons | |
# Show case example for Greenland | |
# =================================================================================== | |
# __________ Load needed libraries __________ # | |
library(data.table) | |
library(ggplot2) | |
library(maps) |
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
# =================================================================================== | |
# Shift central/prime meridian (data.table + ggplot) | |
# Inspired from the answer of Joris Meys given here: | |
# http://stackoverflow.com/questions/5353184/fixing-maps-library-data-for-pacific-centred-0-360-longitude-display | |
# and the code of Claudia Engel at: https://gist.github.com/cengel/2165374#file-greatcircleflights-r | |
# or at: http://web.stanford.edu/~cengel/cgi-bin/anthrospace/great-circles-on-a-recentered-worldmap-in-ggplot | |
# | |
# NOTE: Fails to properly display Antarctica | |
# (extra points need to be added in order to properly close the polygons at -90 dg) | |
# Check a different solution here: https://gist.github.com/valentinitnelav/b4d76cd9e84414ac4d1ac48d64615784 |
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
# =================================================================================== | |
# Shift central/prime meridian and plot world map with ggplot | |
# =================================================================================== | |
# __________ Load needed libraries __________ # | |
library(data.table) | |
library(ggplot2) | |
library(rgdal) | |
library(rgeos) | |
library(maps) |
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
# define the function: | |
Interaction.Plots_fun <- function(MyMatrix.lst, data.lst) { | |
# storing default par() for reverting par to original/default values | |
par.default <- par() | |
# on.exit(par(par.default)) # when exiting function par(), restore to default (? - need to test!) | |
# par(par.default) # or simply call each time this line | |
# open a pdf device with desired parameters | |
pdf(file=paste0("Mueller ", format(Sys.time(), "%Y-%m-%d %H-%M-%p"), ".pdf"), onefile=TRUE, width=24, height=8.27) | |
# remember that an A4 is 8.27 × 11.69 in. Here you want a landscape format width > height! |
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
# ============================================================================================================= | |
# Scraps the TPL web page for all families of angiosperms and downloads the corresponding *csv files. | |
# Then grabs the unique species names from this pile of data and builds a custom dictionary for a spell checker. | |
# ============================================================================================================= | |
# _________ Read the family names from the TPL web page (Angiosperms only) _________ # | |
# I adapted code from http://www.stat.berkeley.edu/~spector/s133/Readexample.html for parsing through web pages | |
thepage <- readLines("http://www.theplantlist.org/1.1/browse/A/") | |
# One can notice that family names are in rows of such patern: | |
# <i class=\"family\">Piperaceae</i></a>" |
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
# ====================================================================================== | |
# Create a simple world map in Eckert IV projection with labeled graticules using ggplot. | |
# Repel overlapping text labels with ggrepel. | |
# Eckert IV is a nice looking equal-area projection :) | |
# https://upload.wikimedia.org/wikipedia/commons/c/c5/Ecker_IV_projection_SW.jpg | |
# ====================================================================================== | |
# Set a working directory with setwd() or work with an RStudio project | |
# ~~~~~~~~~~~ Set libraries ~~~~~~~~~~~ # |