This file contains hidden or 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
#ModernMapEurasia.r | |
#Kathryn Turner, June 17, 2013 | |
#With extensive help from Andy South | |
#to create a reprojected map of the Northern Hemisphere | |
#color code countries for range | |
#and add collection sites | |
#in a Lambert azimuthal equal area projection, with the North Pole in the center | |
library(rgdal) # Commands for reprojecting the vector data. |
This file contains hidden or 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
#####Minima.mer.func.R##### | |
#Kathryn Turner June 21, 2013 | |
#Given an output kmer counting histogram table from jellyfish, | |
#find two minima around a peak | |
#input table from jellyfish | |
dat <- read.table("data.from.jellyfish.hist", head=T) | |
head(dat) | |
frequency multiplicity |
This file contains hidden or 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
#Extract climate data from WorldClim.org tiles for several locations and make data table | |
#Kathryn Turner Sept 16, 2013 | |
#download and unzip all relevant WorldClim geoTIFF files into a single directory. | |
#I used the highest resolution (~1km2), but should work for other resolutions too. | |
#load packages: raster, rgdal, foreach | |
library(rgdal) | |
library(raster) | |
library(foreach) |
This file contains hidden or 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
#Functions to squish groups of columns together | |
#Kathryn Turner Sept 20, 2013 | |
#With help from Andrew MacDonald @polesasunder | |
#given data that have many NAs and non-overlapping values | |
#across several columns, with similarly named columns within a group | |
> head(clim) | |
alt_07.tif alt_11.tif alt_12.tif alt_15.tif alt_16.tif alt_17.tif bio1_07.tif bio1_11.tif bio1_12.tif bio1_15.tif bio1_16.tif bio1_17.tif bio10_07.tif | |
BG001 NA NA NA NA 61 NA NA NA NA NA 121 NA NA | |
CA001 NA 24 NA NA NA NA NA 100 NA NA NA NA NA |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
#latitude and longitude | |
#convert types and add to design files | |
popgps<- read.table(file.choose(), header=T, sep=",",quote='"', row.names=1) #csv of pop, lat, long | |
popgps<-popgps[,1:3] | |
popgps$Longitude<-as.character(popgps$Longitude) | |
popgps$Latitude<-as.character(popgps$Latitude) | |
#add two pops to df | |
popgps["SAND",1]<-"48:12.055" |
This file contains hidden or 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
#generate random number sets with limited overlap | |
#3/28/2018 | |
#with em-bellis | |
####generate random integers from a pool#### | |
#from 1-60, sample 10 | |
sample.int(60, 10) | |
#[1] 34 42 45 54 3 5 20 25 53 40 | |
#such as IDs of populations or individuals from a list |
This file contains hidden or 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
#Download occurence data from GBIF - for few to many spp. | |
#3/25/2019 KG Turner with assistance from S. Chamberlain, rOpenSci.org | |
#Register at gbif.org. You will need to use this email address, user name, and password in the following script. | |
#NB: DON'T COMMIT YOUR PASSWORDS. | |
# R version 3.5.3 (2019-03-11) | |
library(rgbif) #1.2.0 |