Skip to content
Prev 248296 / 398506 Next

Subtracting elements of data.frame

On 2011-01-25 01:20, Vincy Pyne wrote:
You've already had good simple solutions. Here's one more,
using the plyr package:

  require(plyr)
  df_new <- colwise(.fun = function(x) {x - x[1]})(df)

plyr is very handy for all sorts of data manipulations.

Peter Ehlers