Scott Chamberlain (@sckottie/@ropensci)
UC Berkeley / rOpenSci
library('taxize')
classification("Chironomus riparius", db = "gbif")
#> $`Chironomus riparius`
#> name rank id
#> 1 Animalia kingdom 1
#> 2 Arthropoda phylum 54
#> 3 Insecta class 216
#> 4 Diptera order 811
#> 5 Chironomidae family 3343
#> 6 Chironomus genus 1448033
#> 7 Chironomus riparius species 1448237
library('taxa')
taxon_name("Mammalia")
taxon_rank("class")
taxon_id(9681)
mammalia <- taxon(taxon_name("Mammalia"), taxon_rank("class"), taxon_id(9681))
#> <Taxon>
#> name: Mammalia
#> rank: class
#> id: 9681
#> authority: none
felidae <- taxon(taxon_name("Felidae"), taxon_rank("family"), taxon_id(9681))
panthera <- taxon(taxon_name("Panthera"), taxon_rank("genus"), taxon_id(146712))
tigris <- taxon(taxon_name("tigris"), taxon_rank("species"), taxon_id(9696))
tiger <- hierarchy(mammalia, felidae, panthera, tigris)
#> <Hierarchy>
#> no. taxon's: 4
#> Mammalia / class / 9681
#> Felidae / family / 9681
#> Panthera / genus / 146712
#> tigris / species / 9696
library(rgbif)
key <- name_backbone(name='Danaus plexippus', kingdom='animals')$speciesKey
out <- occ_search(taxonKey=key, limit=300, return='data')
gbifmap(out)
library(spocc)
spnames <- c('Accipiter striatus', 'Setophaga caerulescens', 'Spinus tristis')
(out <- occ(query = spnames, from = c('gbif', 'ebird')))
#> Summary of results - occurrences found for:
#> gbif : 75 records across 3 species
#> bison : 0 records across 3 species
#> inat : 0 records across 3 species
#> ebird : 75 records across 3 species
#> ecoengine : 0 records across 3 species
#> antweb : 0 records across 3 species
#> idigbio : 0 records across 3 species
#> obis : 0 records across 3 species
#> ala : 0 records across 3 species
library(scrubr)
NROW(sample_data_1)
#> [1] 1500
sample_data_1 %>%
coord_impossible() %>%
coord_incomplete() %>%
coord_unlikely()
#> # A tibble: 1,294 × 5
#> name longitude latitude date key
#> * <chr> <dbl> <dbl> <dttm> <int>
#> 1 Ursus americanus -79.68283 38.36662 2015-01-14 16:36:45 1065590124
#> 2 Ursus americanus -82.42028 35.73304 2015-01-13 00:25:39 1065588899
#> 3 Ursus americanus -99.09625 23.66893 2015-02-20 23:00:00 1098894889
#> 4 Ursus americanus -72.77432 43.94883 2015-02-13 16:16:41 1065611122
#> 5 Ursus americanus -72.34617 43.86464 2015-03-01 20:20:45 1088908315
#> 6 Ursus americanus -108.53674 32.65219 2015-03-29 17:06:54 1088932238
#> 7 Ursus americanus -108.53691 32.65237 2015-03-29 17:12:50 1088932273
#> 8 Ursus americanus -123.82900 40.13240 2015-03-28 23:00:00 1132403409
#> 9 Ursus americanus -78.25027 36.93018 2015-03-20 21:11:24 1088923534
#> 10 Ursus americanus -76.78671 35.53079 2015-04-05 23:00:00 1088954559
#> # ... with 1,284 more rows
library(geonames)
Find a contry code
GNcountryCode(lat = 47.03, lng = 10.2)
Search for nearby streets
GNfindNearbyStreets(lat = 37.45, lng = -122.18)
Search by place name
GNsearch(q = "london", maxRows = 10)
Postal code search
GNpostalCodeSearch(postalcode = 90210, country = "FI")
library(lawn)
bbox <- c(-118.521, 33.715, -118.145, 34.179)
lawn_hex_grid(bbox, 10, 'miles') %>%
as_feature(hex_grid) %>%
purrr::map(lawn_centroid) %>%
purrr::map(lawn_circle, radius = 5) %>%
view
library(rnoaa)
sta <- 'GHCND:USW00014895'
out1 <- ncdc('GHCND', stationid=sta, datatypeid='PRCP',
startdate = '2010-03-01', enddate = '2010-05-31', limit=500)
out2 <- ncdc('GHCND', stationid=sta, datatypeid='PRCP',
startdate = '2010-09-01', enddate = '2010-10-31', limit=500)
ncdc_plot(out1, out2, breaks="1 month", dateformat="%m/%d")
Cross Platform Phylocom Client!!
library(phylocomr)
taxa_file <- system.file("examples/taxa", package = "phylocomr")
(taxa_str <- readLines(taxa_file))
[1] "campanulaceae/lobelia/lobelia_conferta" "cyperaceae/mapania/mapania_africana"
[3] "amaryllidaceae/narcissus/narcissus_cuatrecasasii"
phylo_file <- system.file("examples/phylo", package = "phylocomr")
(phylo_str <- readLines(phylo_file))
[1] "(((((eliea_articulata,homalanthus_populneus)malpighiales,rosa_willmottiae),((macrocentrum_neblinae,qualea_clavata),hibiscus_pohlii)malvids),(((lobelia_conferta,((millotia_depauperata,(layia_chrysanthemoides,layia_pentachaeta)layia),senecio_flanaganii)asteraceae)asterales,schwenkia_americana),tapinanthus_buntingii)),(narcissus_cuatrecasasii,mapania_africana))poales_to_asterales;"
(tree <- ph_phylomatic(taxa = taxa_str, phylo = phylo_str))
[1] "(lobelia_conferta:5.000000,(mapania_africana:1.000000,narcissus_cuatrecasasii:1.000000):1.000000)poales_to_asterales;"
library(phytools)
plot(read.newick(text = tree))