Skip to content

Instantly share code, notes, and snippets.

View sckott's full-sized avatar
😸

Scott Chamberlain sckott

😸
View GitHub Profile
@sckott
sckott / image.md
Created December 1, 2012 09:52
Comparison of two packages

image

Plants Non-Toxic to Cats

Achira (Canna, Arrowroot) | Scientific Name: Canna edulis | Family: Cannaceae Acorn Squash (Similar plants:pumpkin, zucchini) | Scientific Name: Cucurbita pepo | Family: Cucurbitaceae African Daisy (Barberton Daisy, Veldt Daisy, Transvaal Daisy, Gerber Daisy) | Scientific Name: Gerbera jamesonii | Family: Compositae African Violet (Cape Marigold) | Scientific Name: Saintpaulia spp. | Family: Gesneriaceae Algaroba (Kiawe, Mesquite) | Scientific Name: Prosopis limensis | Family: Mimosaceae Aluminum Plant (Watermelon Plant) | Scientific Name: Pilea cadieri | Family: Urticaceae Alumroot (Coral Bells, Heuchera) | Scientific Name: Heuchera sanguinea | Family: Saxifragaceae

@sckott
sckott / getfishnames.r
Last active October 13, 2015 20:38
How to get fish names downstream from family names using taxize
# How to get fish names downstream from family names using taxize
## load libraries
install.packages(c("plyr","taxize"))
library(taxize); library(plyr)
## get taxonomic serial numbers from ITIS for these two fish families
tsns <- get_colid(c("Anostomidae","Curimatidae"))
## Use the function `downstream` to get all species (specified by the `downto` argument) in these two families
out <- downstream(tsns, downto="Species")
@sckott
sckott / prepdata.R
Created December 10, 2012 22:58 — forked from emhart/server.R
rOpenSci rgbif shiny app test
splist <- c("Accipiter erythronemius", "Junco hyemalis", "Aix sponsa", "Haliaeetus leucocephalus",
"Corvus corone", "Threskiornis molucca", "Merops malimbicus")
out <- lapply(splist, function(x) occurrencelist(x, coordinatestatus=T, maxresults=500))
names(out) <- splist
setwd("~/ShinyApps/rgbif2")
save(out, file="speciesdata.rda")
@sckott
sckott / catalogueoflife.r
Created December 11, 2012 17:43
Two minimal examples of getting Catalogue of Life data
# You can get data from Catalogue of Life in two different ways, classifications and children taxa
# Install taxize from github, these fxns aren't on the CRAN version yet
install_github('taxize_', 'ropensci')
library(taxize)
# Here are two very minimal examples of each
col_classification(name="Apis")
col_children(name="Apis")
@sckott
sckott / fishbase_example.r
Created December 18, 2012 11:11
Fishbase example fort he BES2012 conference.
install.packages("rfishbase")
library(rfishbase); library(ggplot2)
loadCache()
reef <- which_fish("reef", "habitat", fish.data)
nocturnal <- which_fish("nocturnal", "trophic", fish.data)
reef_species <- fish_names(fish.data[reef])
nocturnal_nonreef_orders <- fish_names(fish.data[nocturnal & !reef], "Class")
age <- getSize(fish.data, "age")
depths <- getDepth(fish.data)
@sckott
sckott / beswordles.r
Created December 21, 2012 18:13
Wordles for #BES12 tweets
#
install.packages(c("twitteR","wordcloud","tm"))
library(twitteR); library(wordcloud); library(tm)
# Search for #bes12 tweets
bestweets <- searchTwitter("#bes12", n=5000)
length(bestweets) # ends up with 1344 as of 21-Dec-12 at 17:00 London time
# make into a data.frame
bestweets_df <- twListToDF(bestweets)
#!/bin/bash
#PBS -S /bin/bash
#PBS -m bea
#PBS -M [email protected]
#PBS -l walltime=30:00:00
#PBS -N treeshape_pbsdsh
#PBS -l procs=4
module load application/python/2.7.3
module load compiler/intel/12.1
@sckott
sckott / rgbif_eg.r
Created January 10, 2013 21:14
In this example, both of these return what I think you want. Do these work for you? If not, let me know and send along the output from sessionInfo().
# the CRAN version
install_github("rgbif", "ropensci")
library(rgbif)
name <- "Turdus migratorius" # American Robin
out1 <- occurrencelist(scientificname=name, coordinatestatus = TRUE, maxresults = 20)
# the github version
install.packages("rgbif")
library(rgbif)
out1 <- occurrencelist(scientificname=name, coordinatestatus = TRUE, maxresults = 20)
@sckott
sckott / getgbifsynonyms.r
Last active December 10, 2015 23:08
Get GBIF records for a species, including synonyms of the species name.
# Install GBIF
install.packages("devtools")
library(devtools)
install_github("rgbif", "ropensci")
library(rgbif)
# To get synonyms of a species you have to use its taxonconceptkey (GBIF parlance) in the `occurrencelist` function.
# So lets get the taxonconceptkey first using taxonsearch function. You have to set dataresourcekey=1 to get the sort
# of master taxonconceptkey for the species
tck <- taxonsearch(scientificname = 'Euphydryas editha', dataresourcekey=1)