# Blog Archives

February 27, 2012
By

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 →

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

June 16, 2011
By

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 →

## Boxplots without boxes

June 14, 2011
By

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 →

## R in a nutshell

June 1, 2011
By

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!

## More fun with boxplots

May 19, 2011
By

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 →

## Converting vectors to numeric in mixed-type dataframe

May 19, 2011
By

Coercing variables of character and numeric type into a single dataframe yields all vectors to be defined as factors all <- data.frame(cbind(site, year, model, x, y, z)) The following converts selected variables from “factor” back to “numeric” all\$x <- as.numeric(x) … Continue reading →

## Mapping points

May 16, 2011
By

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 →

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

April 7, 2011
By

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 →

## More fun with sed

March 18, 2011
By

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 →

## Converting text files with sed

March 3, 2011
By

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 */.