Hello everybody. I have this object
procedure property sensor_data sensor_date 1 S_10 nord 626821.0 2002-09-30T00:00:00+0200 2 S_10 nord 626821.0 2002-12-05T00:00:00+0100 3 S_10 nord 626821.1 2008-07-31T00:00:00+0200 4 S_1000 nord 626496.8 2002-09-30T00:00:00+0200 5 S_1000 nord 626496.8 2002-12-05T00:00:00+0100 6 S_1000 nord 626496.9 2009-04-23T00:00:00+0200 7 S_1000 nord 626497.0 2009-11-10T00:00:00+0100 8 S_1 nord 626485.3 2002-09-30T00:00:00+0200 9 S_1 nord 626485.3 2002-12-05T00:00:00+0100 10 S_1 nord 626485.3 2003-02-07T00:00:00+0100 the third colomn (sensor_data) is a distance in meters. each distance has a date (sensor_date) for each row I would like to find the difference from the first distance (with the min date) and the distance. I know it's difficult to understand.. I give you an example: for the first procedure S_10 I should find the first distance based on the date: distance: 626821.0 with the date: 2002-09-30T00:00:00+0200 then I should do the difference between the current distance and the first distance: 626821.0 - 626821.0 = 0.0 626821.0 - 626821.0 = 0.0 626821.1 - 626821.0 = 0.1 Then I should do this also for the other procedures. I would like a resut like this: procedure property sensor_data sensor_date difference 1 S_10 nord 626821.0 2002-09-30T00:00:00+0200 0.0 2 S_10 nord 626821.0 2002-12-05T00:00:00+0100 0.0 3 S_10 nord 626821.1 2008-07-31T00:00:00+0200 0.1 4 S_1000 nord 626496.8 2002-09-30T00:00:00+0200 0.0 5 S_1000 nord 626496.8 2002-12-05T00:00:00+0100 0.0 6 S_1000 nord 626496.9 2009-04-23T00:00:00+0200 0.1 7 S_1000 nord 626497.0 2009-11-10T00:00:00+0100 0.2 8 S_1 nord 626485.3 2002-09-30T00:00:00+0200 0.0 9 S_1 nord 626485.3 2002-12-05T00:00:00+0100 0.0 10 S_1 nord 626485.3 2003-02-07T00:00:00+0100 0.0 How can I do this procedure????? Thanks -- View this message in context: http://r.789695.n4.nabble.com/multi-Operations-on-a-matrix-tp3250807p3250807.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.