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
library(entropy) | |
library(ggplot2) | |
olaps <- function(sp1, sp2){ | |
sp1 <- sp1/sum(sp1) | |
sp2 <- sp2/sum(sp2) | |
plot.table <- data.frame(species = c(rep("sp1", length(sp1)), rep("sp2", length(sp2))), | |
env = c(seq(1:length(sp1)), seq(1:length(sp2))), |
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
# Function to rarefy point data in any number of dimensions. The goal here is to | |
# take a large data set and reduce it in size in such a way as to approximately maximize the | |
# difference between points. For instance, if you have 2000 points but suspect a lot of | |
# spatial autocorrelation between them, you can pass in your data frame, the names (or indices) | |
# of the lat/lon columns, and the number 200, and you get back 200 points from your original data | |
# set that are chosen to be as different from each other as possible given a randomly chosen | |
# starting point | |
# Input is: | |
# |