monkey's uncle

notes on human ecology, population, and infectious disease

monkey's uncle header image 4

Plotting Error Bars in R

August 24th, 2009 · 52 Comments

One common frustration that I have heard expressed about R is that there is no automatic way to plot error bars (whiskers really) on bar plots.  I just encountered this issue revising a paper for submission and figured I'd share my code.  The following simple function will plot reasonable error bars on a bar plot. […]

[Read more →]

Tags: R

Why Use R?

July 25th, 2009 · 4 Comments

An anthropologist colleague who did a post-doc in a population center has been trying to get a group of people at his university together to think about population issues.  This is something I'm all for and am happy to help in whatever little way I can to facilitate especially anthropologists developing their expertise in demography. […]

[Read more →]

Tags: Demography · R · Statistics

Platform for Developing Mathematical Models of Infectious Disease

April 14th, 2009 · 3 Comments

Every once in a while someone asks me for advice on the platform to use for developing models of infectious disease.  I typically make the same recommendations -- unless the person asking has something very specific in mind. This happened again today and I figured I would turn it into a blog post. The answer […]

[Read more →]

Tags: Infectious Disease · R · Social Network Analysis

Exporting Deviance Tables to (ugh) Word

January 30th, 2009 · No Comments

I do my absolute best to minimize the amount of time Word is open on my computer desktop.  Alas, when one collaborates widely, particularly with non-technical people, it is a necessary evil. In these collaborations, I am typically doing either statistical or modeling work (or both). This often means that I am generating objects in […]

[Read more →]

Tags: LaTeX · R

New York Times Discovers R

January 6th, 2009 · 2 Comments

A recent article in the New York Times extolls the virtues of the R statistical programming language.  Better late than never, I suppose.  I first discovered R in 1999, just as I began writing my dissertation. At the time, I used Matlab for all my computational needs.  I still occasionally use Matlab when doing hardcore matrix algebra […]

[Read more →]

Tags: R

Plotting Recruitment Curves

January 2nd, 2009 · No Comments

I was asked how I plotted the recruitment curve from my last post. It's pretty easy to do in R. PLAIN TEXT R: Dn <- expression(r * (1 - N/K) * N) r <- 0.004 K <- 10^10 N <- seq(0,10^10,by=10^7) png(file="recruitment.png") ## sends output to .png file plot(N,eval(Dn),type="l", xlab="Human Population", ylab="Recruitment") dev.off() Now we […]

[Read more →]

Tags: Demography · Human Ecology · R

Nearly Neutral Networks and Holey Adaptive Landscapes

December 29th, 2008 · 2 Comments

My holiday reading on modularity has led me into some of the literature on the evolution of complexity.  Some of the most interesting work in theoretical biology that I've read in a while relates to the ideas of nearly neutral networks and holey adaptive landscapes, an area developed by Sergey Gavrilets at the University of […]

[Read more →]

Tags: Evolution · R · Social Network Analysis

Arrgh...

September 20th, 2008 · No Comments

I never did get around to writing about International Talk Like a Pirate Day yesterday.  Carl Boe, from Berkeley, and I have a long-running joke about pirate-speak stemming from our teaching computing for formal demography using that old swashbuckler standby software -- you guessed it -- R.  We wanted to reduce the anxiety generated in […]

[Read more →]

Tags: R