spocc (version 0.1.2)

spocc_gist: Post a file as a Github gist

Description

You will be asked ot enter you Github credentials (username, password) during each session, but only once for each session. Alternatively, you could enter your credentials into your .Rprofile file with the entries

  1. options(github.username = 'your_github_username')
  2. options(github.password = 'your_github_password')

then gist will simply read those options.

gist was modified from code in the rCharts package by Ramnath Vaidyanathan

Usage

spocc_gist(gist, description = "", public = TRUE, browse = TRUE)

Arguments

gist
An object
description
brief description of gist (optional)
public
whether gist is public (default: TRUE)
browse
If TRUE (default) the map opens in your default browser.

Value

  • Posts your file as a gist on your account, and prints out the url for the gist itself in the console.

Examples

Run this code
library(plyr)
splist <- c('Accipiter erythronemius', 'Junco hyemalis', 'Aix sponsa')
keys <- sapply(splist, function(x) gbif_lookup(name=x, kingdom='plants')$speciesKey,
   USE.NAMES=FALSE)
out <- occ_search(keys, hasCoordinate=TRUE, limit=50, return='data')
dat <- ldply(out)
datgeojson <- spocc_stylegeojson(input=dat, var='name',
   color=c('#976AAE','#6B944D','#BD5945'), size=c('small','medium','large'))
write.csv(datgeojson, '~/my.csv')
spocc_togeojson(input='~/my.csv', method='web', outfilename='my')
spocc_gist('~/my.geojson', description = 'Occurrences of three bird species mapped')

Run the code above in your browser using DataLab