Skip to content

Commit

Permalink
added vignettes to vignettes folder from inst/vign
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Feb 16, 2014
1 parent f7a8b6e commit 08c01c9
Show file tree
Hide file tree
Showing 99 changed files with 2,250 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
all: move pandoc rmd2md

vignettes:
cd inst/vign;\
Rscript -e 'library(knitr); knit("rgbif_vignette.Rmd"); knit("rgbif_vignette.Rmd")'
Rscript -e 'library(knitr); knit("rgbif_vignette_oldapi.Rmd"); knit("rgbif_vignette_oldapi.Rmd")'

move:
cp inst/vign/rgbif_vignette.md vignettes;\
cp inst/vign/rgbif_vignette_oldapi.md vignettes;\
cp -r inst/vign/figure/ vignettes/figure/

pandoc:
cd vignettes;\
pandoc -H margins.sty rgbif_vignette.md -o rgbif_vignette.html;\
pandoc -H margins.sty rgbif_vignette.md -o rgbif_vignette.pdf;\
pandoc -H margins.sty rgbif_vignette_oldapi.md -o rgbif_vignette_oldapi.html;\
pandoc -H margins.sty rgbif_vignette_oldapi.md -o rgbif_vignette_oldapi.pdf

rmd2md:
cd vignettes;\
cp rgbif_vignette.md rgbif_vignette.Rmd;\
cp rgbif_vignette_oldapi.md rgbif_vignette_oldapi.Rmd

cleanup:
cd inst/vign;\
rm rgbif_vignette.md rgbif_vignette_oldapi.md
rm -r vignettes/figure/
10 changes: 10 additions & 0 deletions inst/vign/cache/__packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
base
bitops
ggplot2
knitr
maps
plyr
RCurl
rgbif
rjson
XML
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file added inst/vign/figure/densitylist2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/vign/figure/gbifmap1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/vign/figure/occurrencelist_many.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
151 changes: 151 additions & 0 deletions inst/vign/rgbif_vignette.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<!--
%\VignetteEngine{knitr}
%\VignetteIndexEntry{Tutorial for the new GBIF API}
-->

rgbif vignette - Seach and retrieve data from the Global Biodiverity Information Facilty (GBIF)
======

## About the package

`rgbif` is an R package to search and retrieve data from the Global Biodiverity Information Facilty (GBIF). `rgbif` wraps R code around the [GBIF API][gbifapi] to allow you to talk to GBIF from R.

********************

## Install rgbif and dependencies

```{r install, eval=FALSE}
install.packages("rgbif")
```

## Load rgbif and dependencies

```{r load, comment=NA, warning=FALSE, message=FALSE}
library(rgbif); library(XML); library(RCurl); library(plyr); library(ggplot2); library(maps)
```

********************

## Get number of occurrences for a set of search parameters

### Search by type of record, all observational in this case

```{r occ_count1, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_count(basisOfRecord='OBSERVATION')
```

### Records for **Puma concolor** with lat/long data (georeferened) only

```{r occ_count2, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_count(nubKey=2435099, georeferenced=TRUE)
```

### All georeferenced records in GBIF

```{r occ_count3, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_count(georeferenced=TRUE)
```

### Records from Denmark

```{r occ_count4, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_count(country='DENMARK')
```

### Records from France

```{r occ_count5, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_count(hostCountry='FRANCE')
```

### Number of records in a particular dataset

```{r occ_count6, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_count(datasetKey='9e7ea106-0bf8-4087-bb61-dfe4f29e0f17')
```

### All records from 2012

```{r occ_count7, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_count(year=2012)
```

### Records for a particular dataset, and only for preserved specimens

```{r occ_count8, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_count(datasetKey='8626bd3a-f762-11e1-a439-00145eb45e9a', basisOfRecord='PRESERVED_SPECIMEN')
```

********************

## Get possible values to be used in taxonomic rank arguments in functions

```{r taxrank, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
taxrank()
```

********************

## Search for taxon information

### Search for a genus

```{r name_lookup1, comment=NA, warning=FALSE, message=FALSE}
head(name_lookup(query='Cnaemidophorus', rank="genus", return="data"))
```

### Search for the class mammalia

```{r name_lookup2, comment=NA, warning=FALSE, message=FALSE}
head(name_lookup(query='mammalia')$data)
```

### Look up the species Helianthus annuus

```{r name_lookup3, comment=NA, warning=FALSE, message=FALSE}
head(name_lookup('Helianthus annuus', rank="species")$data)
```

********************

## Get data for a single occurrence. Note that data is returned as a list, with slots for metadata and data, or as a hierarchy, or just data.

### Just data

```{r occ_get1, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_get(key=773433533, return='data')
```

### Just taxonomic hierarchy

```{r occ_get2, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_get(key=773433533, return='hier')
```

### All data, or leave return parameter blank

```{r occ_get3, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_get(key=773433533, return='all')
```

### Get many occurrences. `occ_get` is vectorized

```{r occ_get4, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
occ_get(key=c(773433533,101010,240713150,855998194,49819470), return='data')
```

********************

## Maps

### Static map using the ggplot2 package

Make a map of **Puma concolor** occurrences

```{r gbifmap1, comment=NA, warning=FALSE, message=FALSE, cache=TRUE}
key <- name_backbone(name='Puma concolor', kingdom='plants')$speciesKey
dat <- occ_search(taxonKey=key, return='data', limit=300, minimal=FALSE)
gbifmap(input=dat)
```

[gbifapi]: http://data.gbif.org/tutorial/services
Loading

0 comments on commit 08c01c9

Please sign in to comment.