RNetLogo - A package for running NetLogo from R

Described in a new Methods in Ecology and Evolution paper here, a new R package RNetLogo allows you to use NetLogo from R. NetLogo is software is a “multi-agent programmable modeling environment”. NetLogo can be used in individual- and agent-based modeling, and is used in the book Agent-based and Individual-based Modeling: A Practical Introduction by Railsback & Grimm. I have not tried the package yet, but looks interesting. I am always a fan of running stand-alone programs from R if possible. ...

January 23, 2012 · 1 min · Scott Chamberlain

Taking a Closer Look at Peer Review

This post is only tangentially about open science. It is more directly about the process of peer review and how it might be improved. I am working on a follow-up post about how these points can be addressed in an open publishing environment. A recent paper on the arXiv got me thinking about the sticking points in the publishing pipeline. As it stands, most scientists have a pretty good understanding of how peer reviewed publishing is supposed to work. Once an author—or more likely, a group of authors—decides that a manuscript is ready for action, the following series of events will occur: ...

January 16, 2012 · 7 min · Pascal Mickelson

Function for phylogeny resolution

UPDATE: Yeah, so the treeresstats function had a problem in one of the calculations. I fixed that and added some more calulcations to the function. I couldn’t find any functions to calculate number of polytomies, and related metrics. Here’s a simple function that gives four metrics on a phylo tree object: # calculate tree resolution stats treeresstats <- function(x) { require(phangorn) # load the phangorn package todo <- ( 1+Ntip(x)) : (Ntip(x) + Nnode(x) ) trsize_tips <- Ntip(x) trsize_nodes <- Nnode(x) polytomyvec <- sapply(todo, function(y) length(Children(x, y))) numpolys <- length(polytomyvec[polytomyvec > 2]) numpolysbytrsize_tips <- numpolys/trsize_tips numpolysbytrsize_nodes <- numpolys/trsize_nodes proptipsdescpoly <- sum(polytomyvec[polytomyvec > 2])/trsize_tips propnodesdich <- length(polytomyvec[polytomyvec == 2])/trsize_nodes list(trsize_tips = trsize_tips, trsize_nodes = trsize_nodes, numpolys = numpolys, numpolysbytrsize_tips = numpolysbytrsize_tips, numpolysbytrsize_nodes = numpolysbytrsize_nodes, proptipsdescpoly = proptipsdescpoly, propnodesdich = propnodesdich) } # Single tree example tree <- read.tree(text="((((((artemisia_species:44,lactuca_species:44,senecio_species:44)6:46,campanula_species:90)5:17.75,((asclepias_species:71,galium_species:71)8:18.375,plantago_species:89.375)7:18.375)4:17.75,((cerastium_species:41.833332,silene_species:41.833332)10:41.833332,chenopodium_species:83.666664)9:41.833336)3:17.75,((geum_species:47,potentilla_species:47)12:48.125,lepidium_species:95.125)11:48.125)2:17.75,(bromus_species:12,elymus_species:12)13:149)1;") dat <- treeresstats(tree) dat # Many trees example maketrees <- function(numtrees) { require(ape); require(plyr) trees <- rmtree(numtrees, 20) llply(trees, di2multi, tol = 0.5) } trees <- maketrees(30) dat <- ldply(trees, function(x) data.frame(treeresstats(x))) dat Here’s output from the gist above: ...

January 13, 2012 · 2 min · Scott Chamberlain

Moving from blogger and wordpress to jekyll

Recology used to be hosted on Blogger, and my personal website was hosted on Wordpress. Neither platform was very satisfying. Blogger is very limited in their layouts, unless you use dynamic views, which suck because they don’t allow javascript snippets to render GitHub gists. Wordpress is just limited all around as you can’t put in hardly anythig excep text and some pictures. They both have their place, but not so much for content that requires syntax highlighting, references, etc. ...

January 11, 2012 · 3 min · Scott Chamberlain

Presenting results of logistic regression

So my advisor pointed out this ’new’ (well, 2004), way of plotting results of logistic regression results. The idea was presented in a 2004 Bulletin of the Ecological Society of America issue (here). I tried to come up with a solution using, what else, ggplot2. I don’t have it quite all the way down - I am missing the second y-axis values for the histograms, but someone smarter than me can figure that part out (note that Hadley doesn’t want to support second y-axes in ggplot2, but they can probably be hacked on). ...

January 10, 2012 · 3 min · Scott Chamberlain

Testing twitterfeed

Does this work on twitterfeed?

January 8, 2012 · 1 min · Scott Chamberlain

Weecology can has new mammal dataset

So the Weecology folks have published a large dataset on mammal communities in a data paper in Ecology. I know nothing about mammal communities, but that doesn’t mean one can’t play with the data… Their dataset consists of five csv files: communities, references, sites, species, and trapping data Where are these sites, and by the way, do they vary much in altitude? Let’s zoom in on just the states ...

December 29, 2011 · 1 min · Scott Chamberlain

Recology is 1 yr old

This blog has lasted a whole year already. Thanks for reading and commenting. There are a couple of announcements: Less blogging: I hope to put in many more years blogging here, but in full disclosure I am blogging for Journal of Ecology now, so I am going to be (and already have been) blogging less here. More blogging: If anyone wants to write guest posts at Recology on the topics of using R for ecology and evolution, or open science, please contact me. Different blogging: I was going to roll out the new dynamic views for this blog, but Google doesn’t allow javascript, which is how I include code using GitHub gists. Oh well… Anywho, here is the breakdown of visits to this blog, visualized using #ggplot2, of course. There were a total of about 23,000 pageviews in the first year of this blog. ...

December 23, 2011 · 1 min · Scott Chamberlain

Dynamic views don't support javascript-so reverting back to simple views

Sorry for the temporary loss of GitHub gists…Hopefully dynamic views will support javascript soon!!

December 22, 2011 · 1 min · Scott Chamberlain

I Work For The Internet !

UPDATE: code and figure updated at 647 AM CST on 19 Dec ‘11. Also, see Jarrett Byrnes (improved) fork of my gist here. The site I WORK FOR THE INTERNET is collecting pictures and first names (last name initials only) to show collective support against SOPA (the Stop Online Piracy Act). Please stop by their site and add your name/picture. I used the #rstats package twitteR, created by Jeff Gentry, to search for tweets from people signing this site with their picture, then plotted using ggplot2, and also used Hadley’s lubridate to round timestamps on tweets to be able to bin tweets in to time slots for plotting. ...

December 13, 2011 · 1 min · Scott Chamberlain