# ggplot2

### Transforming a color scale

October 3, 2012 |

In developing plots, I often use color (or “colour” in ggplot2 parlance) to reflect values of a third, non-X/Y, variable. Depending on the distribution of this Z variable, however, the effective color range can be narrow, making it difficul... [Read more...]

### A replacement for theme_blank()

October 2, 2012 |

ggplot2 has just hit 0.9.2, and with the change comes a new theme system. Previous versions of ggplot2 offered a theme_blank(), which was a stripped-down, essentially blank plotting canvas, but it is now deprecated. github user jrnold has produced a s... [Read more...]

### Optimal seriation for your matrices

September 28, 2012 |

In our previous post, we used a quick-and-dirty method for ordering the axes on our heatmap. It has been pointed out to me that There is a Package for That (which is my nominee for a new slogan for R — not that it needs a slogan). seriation offe... [Read more...]

### Simplest possible heatmap with ggplot2

September 27, 2012 |

Featuring the lovely “spectral” palette from Colorbrewer. This really just serves as a reminder of how to do four things I frequently want to do: Make a heatmap of some kind of matrix, often a square correlation matrix Reorder a factor vari... [Read more...]

### Visually-weighted regression plots, with Zelig

September 25, 2012 |

As a follow-up to yesterday’s post on producing visually-weighted regression plots, here is some code which illustrates the production of similar plots, but using Zelig’s convenient modeling and simulation functions. This code was produced... [Read more...]

### Simple visually-weighted regression plots

September 24, 2012 |

There has recently been a lot of discussion of so-called “visually-weighted regression” plots. Folk hero Hadley Wickham suggests that such plots would be easy to implement with ggplot2, and so I have attempted to prove him right. The approa... [Read more...]

### Automatic drug utilization reports with R and ggplot2

September 18, 2012 |

This program takes a data set of drug utilisation of 4 fictional drugs in 10 fictional hospitals and plots each time-series with a locally weighted regression (Lowess) trend line. It also places an time-series trend of the usage for each … Continue reading → [Read more...]

### Add Text Annotations to ggplot2 Faceted Plot (an easier approach)

September 6, 2012 |

I recently posted a blog about adding text to a ggplot2 faceted plot (LINK). I was unhappy with the amount of time it takes to create the text data frame to then label the plot. And then yesterday when the … Continue reading →

### Add Text Annotations to ggplot2 Faceted Plot

August 31, 2012 |

In my experience with R learners there are two basic types. The “show me the code and what it does and let me play” type and the “please give me step by step directions” type. I’ve broken the following tutorial … Continue reading →

### Genetic algorithms: a simple R example

August 1, 2012 |

Genetic algorithm is a search heuristic. GAs can generate a vast number of possible model solutions and use these to evolve towards an approximation of the best solution of the model. Hereby it mimics evolution in nature. GA generates a population, the individuals in this population (often called chromosomes) have  ... [Read more...]

### Evolution average number of beds per hospital

July 27, 2012 |

The OECD collects (among a lot of other statistics) information on the number of hospitals and hospital beds per country. These two parameters combined and its evolution over the years could give an indication on whether or not the country’s hospital landscape is evolving towards large medical centers, small ... [Read more...]

### Estimating required hospital bed capacity

July 23, 2012 |

Estimating required hospital bed capacity requires a thorough analysis. There are a lot of ways of approaching a capacity requirement problem, but I think we can agree that a simple spreadsheet analysis just won't cut it. The approach described in this post makes use of discrete-event simulation and, just ... [Read more...]

### Using discrete-event simulation to simulate hospital processes

July 12, 2012 |

Discrete-event simulation is a very useful tool when it comes to simulating alternative scenario’s for current of future business operations. Let’s take the following case; Patients of an outpatient diabetes clinic are complaining about long waiting times, this seems to have an adverse effect on patient satisfaction and ... [Read more...]

### Review: Kölner R Meeting 6 July 2012

July 10, 2012 |

The second Cologne R user meeting took place last Friday, 6 July 2012, at the Institute of Sociology. Thanks to Bernd Weiß, who provided the meeting room, we didn't have to worry about the infrastructure, like we did at our first gathering. Again, we ...

### SMS analysis (coming from an Android smartphone or an IPhone)

July 7, 2012 |

At first, this post was intended to describe how to manipulate dates with R but, as the idea was coming from the question of one of my students who wanted to analyze his SMS, I thought that I might as well also explain the whole analysis process... Using my new ... [Read more...]

### Timeline graph with ggplot2

July 7, 2012 |

This post shows how to create a timeline graph by using ggplot2. Let’s start by loading the ggplot2 library. Next let’s create a dataset which we will use to feed the graph. In the last column (y), I create random positive values for the first three rows (which ... [Read more...]

### Euro 2012: Day 18

June 25, 2012 |

As promised. Looks like a Spain Germany final. [Read more...]

### Experimental Design: Problem Set

June 21, 2012 |

QUESTIONSThe tensile strength of Portland cement is being studied. Four different mixing techniques can be used economically. The following data have been collected: MixingTechniques Tensile Strength (lb/in­­2) 1 3129 3000 2865 2890 2 3200 3300 2975 3150 3 2800 2900 3985 3050 4 2600 2700 2600 2765 Test the hypothesis that mixing techniques affect the strength of the cement. Use $\alpha=0.05$.Construct a graphical display as described in Section 3...

### Euro 2012: End of Group Stage

June 20, 2012 |

Time for an update of the plots. Here are the teams still left in the competition. This is the group stratification. Finally, the busy plot. [Read more...]

### Notes from A Recent Spatial R Class I Gave

June 19, 2012 |

Below is a link to a pdf (compiled with the amazing knitr package) and some accompanying data for a recent short course I gave on basic spatial data import/analysis/visualization in R. The class was only two hours and some of the participants were bein... [Read more...]
1 2 3 4 11