Blog Archives

Interactive visualization of survival curves with Shiny

April 3, 2013
By
Interactive visualization of survival curves with Shiny

We have a growing interest in using our favorite tools (R and Mathematica) to build web interfaces to interactively explore and visualize data. Our last 5 posts have involved interactive tools, namely Mathematica’s computable document format and R’s new Shiny package. There is a new kid on the block for interactive visualization tools in R,

Read more »

Shiny = Happy People

January 11, 2013
By

The people behind the wonderful RStudio, which I gushed about in a previous post, have developed a new package, Shiny, that makes it easy to develop interactive web applications with R. Shiny is not the first package to facilitate building web apps with R (see here for comparison of Shiny and gWidgetsWWW2.rapache), but it is

Read more »

Good programming practices in R

September 22, 2012
By

I write sloppy R scripts. It is a byproduct of working with a high-level language that allows you to quickly write functional code on the fly (see this post for a nice description of the problem in Python code) and the result of my limited formal training in computer programming. The lack of formal training

Read more »

RStudio is RStupendous

September 3, 2012
By

I am a sucker for beautiful applications (like the ggplot2 web tool mentioned here). The latest R-related application to catch my eye is RStudio. RStudio™ is a free and open source integrated development environment (IDE) for R. You can run it on your desktop (Windows, Mac, or Linux) or even over the web using RStudio

Read more »

Late to the ggplot2 party

August 29, 2012
By

I have resisted learning the popular R graphics package, ggplot2. I dismissed ggplot2 as primarily useful for exploratory graphics and rationalized my avoidance of ggplot2 by assuming that it would require just as many (or more) lines of code as the R base package to whip the default plots into publication-quality figures. The few times

Read more »

Count data and GLMs: choosing among Poisson, negative binomial, and zero-inflated models

August 24, 2012
By

Ecologists commonly collect data representing counts of organisms. Generalized linear models (GLMs) provide a powerful tool for analyzing count data. The starting point for count data is a GLM with Poisson-distributed errors, but

Read more »

Using paste( ) to read and write multiple files in R

August 19, 2012
By

This post is a quick tip on how to use the paste( ) function to read and write multiple files. First, let’s create some data. The next step is not necessary, but makes the subsequent code more readable. The following example is silly because you would rarely want to split your data as

Read more »

Transformation of axes in R

August 4, 2012
By
Transformation of axes in R

As a general rule, you should not transform your data to try to fit a linear model. But proportions can be tricky. If the proportion data do not arise from a binomial process (e.g., proportion of a leaf consumed by a caterpillar), then transformation is still the best option. In an excellent paper, David Warton*

Read more »

Spacing of multi-panel figures in R

August 2, 2012
By
Spacing of multi-panel figures in R

In a previous post, I showed how to keep text and symbols at the same size across figures that have different numbers of panels. The figures in that post were ugly because they used the default panel spacing associated with the mfrow argument of the par( ) function. Below I will walk through how to

Read more »

Text and symbol size in multi-panel figures in R

July 31, 2012
By
Text and symbol size in multi-panel figures in R

In R, there are a couple of packages that allow you to create multi-panel figures (see examples here and here), but, of course, you can also make multi-panel figures in the base package*. Below I provide a simple example for creating a multi-panel figure in the R base package with the focus on making the

Read more »