- this is a link to my home page
- and my blog
- yeah links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A web page with taxa names you want to get trait data from | |
pg1 <- 'http://www.efloras.org/browse.aspx?flora_id=1&start_taxon_id=10074&page=1' | |
# Get the daughter URLs from the taxa on the page, using doMC to speed things up | |
urls <- getdaughterURLs(pg1, cores=TRUE, no_cores=2) | |
|======================================================================================================| 100% | |
# Get the receptacle trait state for the taxa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### mvabund play | |
# install mvabund from CRAN pkg repository | |
install.packages("mvabund") | |
require(mvabund) | |
# plot abundance by copepod species | |
data(Tasmania) | |
attach(Tasmania) | |
tasmvabund <- mvabund(Tasmania$copepods) | |
plot(tasmvabund ~ treatment, col = as.numeric(block)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(ggplot2); require(gridExtra) | |
###Generate box coords | |
###A function to generat a blank box for use with geom_path() | |
box_coords <- function(x,y,size){ | |
b.x <- c(rep(x,2) - (size[1] / 2),rep(x,2) + (size[1] / 2)) | |
b.x[5] <- b.x[1] | |
b.y <- c(y-(size[2] / 2),rep(y,2)+(size[2] / 2),y-(size[2] / 2)) | |
b.y[5] <- b.y[1] | |
rmat <- data.frame(cbind(b.x,b.y)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Store a function with man lines | |
# Go Here: http://beta.opencpu.org/apps/opencpu.demo/storefunction/ | |
# number: x3e50ee0780 | |
# link: http://beta.opencpu.org/R/call/store:tmp/x3e50ee0780/png?id='ropensci'&type='org' | |
the <- function (id = 'hadley', type = 'user') | |
{ | |
require(RCurl); require(RJSONIO); require(ggplot2); require(reshape2); require(plyr) | |
if(type == 'user'){ url = "https://api.github.com/users/" } else | |
if(type == 'org'){ url = "https://api.github.com/orgs/" } else | |
stop("parameter 'type' has to be either 'user' or 'org' ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# my first gistdeck presentation | |
## This is fun | |
* [this is a link to my home page](http://schamberlain.github.com/scott) | |
* [and my blog](http://schamberlain.github.com/blog.html) | |
* yeah links |
- this is a link to my home page
- and my blog
- yeah links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr); library(plyr); require(RCurl) | |
stackexchange_GET <- function(ids, url = "https://api.stackexchange.com/2.0/users/") | |
{ | |
res <- GET(paste0(url, ids), query = list(site = "stackoverflow")) | |
json <- parsed_content(res) | |
json | |
} | |
stackexchange_getURL <- function(ids, url = "https://api.stackexchange.com/2.0/users/") | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apistatus <- function() { | |
require(RCurl); require(RJSONIO); require(ggplot2); require(XML) | |
# PLoS search API | |
if(identical( | |
RJSONIO::fromJSON(RCurl::getURL( | |
"http://api.plos.org/search?q=id:10.1371/journal.pbio.0000012&wt=json"))$response$docs[[1]]$eissn, | |
"1545-7885") == TRUE){plos_search_api <- 1} else | |
{plos_search_api <- 0} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####################################################### | |
###########Community-Network Structure Simulation###### | |
####################################################### | |
library(bipartite) | |
# Set of mean and sd combinations of log-normal distribution | |
mu<-c(0.5,2.9,5.3) | |
sig<-c(0.75,1.6,2.45) | |
make.matrices<-function(a,b,nmats){ |