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
# voluModel Methods in Ecology and Evolution Code Supplement | |
# R version: 4.1.2 (2021-11-01) | |
# Platform: x86_64-apple-darwin17.0 | |
# | |
# Figure 1 ---- | |
library(voluModel) # Because of course | |
library(ggplot2) # For fancy plotting | |
library(rgdal) # For vector stuff. Will eventually be replaced with sf. | |
library(raster) # For raster stuff. Will eventually be replaced with terra. | |
library(viridisLite) # For high-contrast plotting palettes |
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(raster) | |
library(dismo) | |
library(readr) | |
library(BioCalc) | |
workingDirectory <- "USER_WORKING_DIRECTORY/data/inputs/" | |
setwd(paste0(workingDirectory, "PaleoClimateRaw/")) | |
# Read in data and process to rasters ---- | |
precipFiles <- list.files(pattern = "precip") |
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
install.packages(c('ape', 'geiger', 'phytools', 'RColorBrewer', 'plotrix', 'diversitree', 'OUwie', 'fishtree', 'picante', 'caper')) |
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
#Post-processing complementary script | |
#======================================================== | |
#author: Hannah Owens | |
#date: 13 March, 2018 | |
#Set the working directory | |
#==================================== | |
setwd("~/Dropbox/ENMSeminar/Labs:Homeworks/Lab9/Data/"); #Change to YOUR working directory | |
library(raster); |
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(raster); #For raster-based loading, calculations, and mapping | |
library(rgdal); #For reading the M polygon | |
setwd("~/Dropbox/ENMSeminar/Labs:Homeworks/Lab5/Lab5Data/WorldClimTerrestrial/"); | |
#Navigate to folder containing environmental data | |
#Loading a raster stack | |
envtList <- list.files(pattern = ".asc"); #Gets a list of .asc files | |
envtStack <- stack(envtList); #Reads in .asc files as a raster stack | |
crs(envtStack) <- "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0" #Defines projection of layers |
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(spocc); #For getting georefernces | |
library(raster); #For loading and manipulating rasters | |
library(scrubr); #Package introduced for data cleaning | |
library(spatstat); #Spatial statistics package with method for calculating nearest neighbor distance | |
setwd("~/Dropbox/ENMSeminar/Labs:Homeworks/Lab4/"); #Tell R where things go. | |
#Get your data using SPOCC | |
spoccCod <- occ(query = "Gadus morhua", from = c('gbif', 'bison', 'inat', 'ecoengine', 'vertnet', 'idigbio', 'obis'), has_coords = T, limit = 100000000); | |
#Make sure you customize this to take advantage of all of the appropriate databases for your localities. |
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(rgbif); | |
library(spocc); | |
setwd("~/Dropbox/ENMSeminar/Labs:Homeworks/Lab3/"); #Tell R where to put things. | |
#RGBIF | |
#This package works specifically for querying the GBIF database. | |
rGBIFSquirrels <- occ_search(scientificName = "Sciurus niger shermani", hasCoordinate = T); | |
#Searches all GBIF records for squirrels, only returns occurrences with coordinates | |
head(rGBIFSquirrels$data); |
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
#This is the R script for Lab 2 part 1. We will walk you through | |
#how to do some very basic geospatial operations in R. | |
#Load the libraries you'll need. | |
library(raster); | |
library(maptools); | |
library(rgdal); | |
#Set the working directory to the location of the data you | |
#downloaded for Lab 2. This tells R where to read and write |
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
# For niche modeling | |
# =================================================== | |
# For loading, calculations, and mapping of spatial data | |
install.packages("terra") | |
# For data cleaning | |
install.packages("dplyr") | |
# For calculating nearest-neighbor distance | |
install.packages("spatstat") |
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
#For comparative phylogenetics | |
#=================================================== | |
install.packages('ctv'); | |
library('ctv'); | |
install.views('Phylogenetics'); | |
update.views('Phylogenetics'); | |
#For niche modeling | |
#=================================================== | |
#For raster-based loading, calculations, and mapping |
NewerOlder