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
# load devtools and install the preferred version of circleplot | |
library(devtools) | |
install_github('mjwestgate/circleplot') | |
#install_github('goldingn/circleplot') | |
library(circleplot) | |
# set RNG seed | |
set.seed(1) | |
# create a fake symmetric matrix |
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
fuzzyMatch <- function (a, b) { | |
# no-frills fuzzy matching of strings between character vectors | |
# `a` and `b` (essentially a wrapper around a stringdist function) | |
# The function returns a two column matrix giving the matching index | |
# (as `match` would return) and a matrix giving the distances, so you | |
# can check how well it did on the hardest words. | |
# Warning - this uses all of your cores. | |
# load the stringdist package |
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
geti <- function (x, i) { | |
# return the elements of an array `x` of unknown dimension | |
# at the ith index of its first dimension | |
# throw an error if x isn't an array | |
stopifnot(is.array(x)) | |
# get the dimension of x | |
k <- length(dim(x)) |
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
# _____________ ____________ ____________ ___________________ | |
# \ ______ \__ _\ ______ \ _\ ______ \ _\ ___ \______ | |
# \ / \ \ \ \ \ \__ _\ \ \ \ \ _\ \ \/ \ \_____ | |
# \ / \ \ \ \ \ \ \ \ \ \ \ \__ _\ \ \ \ \ \____ | |
# \ /______ \ \ \ \_____\ \ \ \ \ \_____\ \ \ \ \ \ \ \ \___ | |
# \___________\__\_\___________\__\_\_\___________\__\_\_\_\___________\__ | |
# \____________\___\_\____________\___\_\_\____________\__ | |
# \____________\_____\_\____________\___ | |
# SPECIES DISTRIBUTION MODELLING \____________\____ | |
# |
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
# converting maxent/Poisson model output to true probability of presence | |
# clear workspace | |
rm(list = ls()) | |
# set rng seed | |
set.seed(1) | |
# number of datapoints | |
n <- 100000 |
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
# clear the workspace | |
rm(list = ls()) | |
# load the relevant libraries | |
# install.packages(rCUR) | |
library(rCUR) # for CUR decomposition | |
# install.packages(irlba) | |
library(irlba) # for fast svd |
NewerOlder