# Articles by Gregor

February 27, 2012 |

Calculating characteristics such as median, mean,… of a subset of data is quite straightforward in R: For a data set containing results from several “models”, a subset for the model “base” is created by Then, the median of the variable … Continue reading → [Read more...]

### Fixed: Unable to plot a decent x-Axis in a time series plot using zoo

June 16, 2011 |

Here is the link to the original problem. Briefly, I was unable to plot a custom x-axis showing abbreviated months in a time series plot of a zoo object. In the plot.zoo() function set xaxt = "n" to suppress plotting … Continue reading → [Read more...]

### Boxplots without boxes

June 14, 2011 |

Let’s say you have several categories with multiple data points each that you would like to plot as individual points. Even if you have only a single point, the R graphics package will plot a line (without a box for … Continue reading → [Read more...]

### R in a nutshell

June 1, 2011 |

I got this book as a reference for my work with R and do like it. Just after browsing the chapters I already found some useful hints about loading and manipulating data, e.g., loading of fixed-width data files! [Read more...]

### More fun with boxplots

May 19, 2011 |

Here are a few more plotting options for boxplots: Let’s start plotting the full set plot(b$mod, b$x) Plot labels for a subset in full set plot (label all points x __ -1) text(subset(b$mod, b$x __ -1), subset(b$x, b$x __ -1), … Continue reading → [Read more...]

### Converting vectors to numeric in mixed-type dataframe

May 19, 2011 |

Coercing variables of character and numeric type into a single dataframe yields all vectors to be defined as factors all [Read more...]

### Mapping points

May 16, 2011 |

Since I look at mercury concentrations at different measurement stations in North America, visualization using a map with values (of your favourite parameter) plotted as colour-coded circles is quite useful. After some trial & error, here is some very basic code … Continue reading → [Read more...]

### Unable to plot a decent x-Axis in a time series plot using zoo

April 7, 2011 |

I use the R package zoo to plot a yearly time series of weekly averaged data. The problem is that my date variable (m.all\$date) contains week numbers and these are plotted as x-Axis. What I would rather like to to … Continue reading → [Read more...]

### More fun with sed

March 18, 2011 |

So I have this strange date and time string, which I would like to convert to a “useable” date, i.e., something that a spreadsheet programme or R can work with. It looks like this (MON has 3 chars): ddMONyr:hh:mm:ss The … Continue reading → [Read more...]

### Converting text files with sed

March 3, 2011 |

Sed is my friend to change fixed-width text files (e.g., from an R screen output) to a comma delimited file using sed 's/ */,/g' file1 __file2.csv Note the two spaces between s/ and */. [Read more...]