Skip to content

Instantly share code, notes, and snippets.

@bbest
bbest / CourbisBest_SMM-2017_CV-plots.R
Last active October 17, 2017 21:57
try whisker plots on uncertainty estimates
# try whisker plots on uncertainty estimates
library(tidyverse)
d = tribble(
~sp, ~source, ~n, ~cv,
'hw', '1999 Smith', 10400, 0.138,
'hw', '2003 Stevick', 11570, 0.068,
'hw', '2012 Palka', 335, 0.42,
'hw', '2016 Roberts', 1633, 0.07,
@bbest
bbest / test.rmd
Created June 11, 2017 00:51
demonstration of Tibble -> Nest -> Model -> Plot -> TrelliscopeJS
## Tibble -> Nest -> Model -> Plot -> TrelliscopeJS
Source: [schloerke/stat695data](https://github.com/schloerke/stat695data#gapminder)
```{r}
library(gapminder)
tibble::glimpse(gapminder)
# look per continent
@bbest
bbest / maxent_spp_report
Created October 25, 2014 01:08
Here's a quick way to loop through running a bunch of species and generating a document by running Knit HTML in RStudio.
---
title: "Maxent Species Report"
output: html_document
---
Here's a quick way to loop through running a bunch of species and generating a document by running Knit HTML in RStudio.
```{r, results='asis'}
spp = c('a','b','c')
for (sp in spp){
@bbest
bbest / .block
Last active January 7, 2020 14:47
Aster Plot in D3
license: mit
height: 300
scrolling: no
border: no
@bbest
bbest / install_ohicore.R
Last active August 29, 2015 14:02
install ohicore, download ohi-global and launch ohi-global/eez2013
# remove old packages
for (p in c('ohicore','ohigui','rCharts')){
if (p %in% rownames(installed.packages())){
lib = subset(as.data.frame(installed.packages()), Package==p, LibPath, drop=T)
remove.packages(p, lib)
}
}
# install dependencies
for (p in c('devtools')){
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bbest
bbest / install_code.R
Last active January 1, 2016 16:59
Install and launch the Ocean Health Index application. This only needs to be run once when initially installing or later when updating. Please see comments (prefixed with #) for more information.
# remove old packages
for (p in c('ohicore','ohigui','rCharts')){
if (p %in% rownames(installed.packages())){
lib = subset(as.data.frame(installed.packages()), Package==p, LibPath, drop=T)
remove.packages(p, lib)
}
}
# install dependencies
for (p in c('devtools')){
@bbest
bbest / create_regions.py
Last active December 29, 2015 09:29
generate non-overlapping regions extending administrative areas into the ocean within the exclusive economic zone by a given buffer
# create_regions.py: generate non-overlapping regions extending administrative areas into the ocean
# within the exclusive economic zone by a given buffer. For the latest version,
# see: https://gist.github.com/bbest/7650602.
#
# This generates the following shapefiles in the output directory:
# rgns_[offshore|inland]{distance}{units}_[gcs|mol]
# where:
# rgns = regions
# offshore = zone extending from shore to the EEZ
# inland = zone extending from shore inland