rvertnet (version 0.5.0)

dump: Use Vertnet taxon specific dump from KNB

Description

Use Vertnet taxon specific dump from KNB

Usage

dump_init(path, group = "amphibians", table = NULL)

dump_tbl(x)

dump_links()

Arguments

path

(character) Path to a sqlite file on your machine.

group

(character) One of mammals, reptiles, amphibians, fishes, or birds

table

(character) sqlite table name, you can use anything you like, but code defaults to the values in the group parameter

x

An object of class src_sqlite

Details

dump_init creates a src_sqlite class that you can use to query the data either using SQL syntax or dplyr's R syntax. dump_tbl is just a wrapper around tbl to create a tbl class object that you can use to feed directly into dplyr's verbs, like select and filter

References

http://blog.vertnet.org/post/115875718156/the-data-one-thing-about-vertnet-and-big-data

Examples

Run this code
# NOT RUN {
# You first need to create your SQLite databases, e.g, for amphibians:
## In the terminal
# wget 
# https://knb.ecoinformatics.org/knb/d1/mn/v1/object/urn:uuid:afc58110-b9c1-4cf7-b46c-837bdc930a21
# mv urn\:uuid\:afc58110-b9c1-4cf7-b46c-837bdc930a21 vertnet_amphib.gz
# gunzip vertnet_amphib.gz
# sqlite3 amphibians.sqlite

## In SQLite
# sqlite> .separator ','
# sqlite> .import vertnet_amphib amphibians

# After you have a SQLite database, do
# library("dplyr")
# x <- dump_init(path = "~/github/sac/vertnetdumps/amphibians.sqlite")

# use SQL syntax
# tbl(x, sql("SELECT scientificname,title FROM amphibians LIMIT 10"))

# use R syntax
# tab <- x %>% dump_tbl()
# tab %>%
#  filter(year > 2010) %>%
#  select(scientificname, title)
# }

Run the code above in your browser using DataCamp Workspace