Message-ID: <26515212.post@talk.nabble.com>
Date: 2009-11-25T15:55:52Z
From: clion
Subject: difference of two rows
Dear R user,
I'd like to calculate the difference of two rows, where "ID" is the same.
eg.: I've got the following dataframe:
ID YEAR
13 2007
15 2003
15 2006
15 2008
21 2006
21 2007
and I'd like to get the difference, like this:
ID YEAR diff
13 2007 NA
15 2003 3
15 2006 2
15 2008 NA
21 2006 1
21 2007 NA
that should be fairly easy...I hope
Thanks for any helpful comments
B.
--
View this message in context: http://old.nabble.com/difference-of-two-rows-tp26515212p26515212.html
Sent from the R help mailing list archive at Nabble.com.