Dear help-list members, I am a student at Durham University (UK) conducting a PhD on spatial representation in baboons. Currently, I'm analysing the effect of sampling interval on home range calculations. I have followed the baboons for 234 days in the field, each day is represented by about 1000 waypoints (x,y coordinates) recorded at irregular time intervals. Consecutive waypoints in this raw data set have an average distance interval of 5 meters an average time interval of 23 seconds (but when baboons were stationary the time interval could be much larger - e.g. waypoint 7 below).This raw data set needs to become a data set with waypoints at regular intervals and thus, 'new' waypoints have to be 'created'. Eventually, I want to use seven different time intervals: 2, 5, 10, 15, 30, 45 and 60 minute intervals. I have tried in Excel, but I am not managing it. I have some experience with R, and although I can 'read' quite complicated scripts, I am unable to write them, so I would very much appreciate any help anybody would be willing to offer me.
My current data set has 9 columns (in csv / excel file): x coordinate, y coordinate, year, month, day, record, time interval (duration between this waypoint and the previous) (hh:dd:ss), summed time intervals, distance interval (m) EXAMPLE (24th of april 2007) (wp1) x1, y1, 2007, 7, 24, 1, 00:00:00, 00:00:00, 0 (wp2) x2, y2, 2007, 7, 24, 2, 00:00:23, 00:00:23, 2 (wp3) x3, y3, 2007, 7, 24, 3, 00:00:50, 00:00:73, 3 (wp4) x4, y4, 2007, 7, 24, 4, 00:01:20, 00:02:33, 5 (wp5) x5, y5, 2007, 7, 24, 5, 00:00:03, 00:02:36, 1 (wp6) x6, y6, 2007, 7, 24, 6, 00:00:12, 00:02:48, 2 (wp7) x7, y7, 2007, 7, 24, 7, 00:05:45, 00:08:33, 2 Now I need to change this data set into one with waypoints at regular intervals: for example 2 minutes = 120 seconds >> 2 minutes after the first waypoint (x1,y1) the baboons would be somewhere between WP3 and WP4 (at WP3 sum duration is 73 seconds and after WP4 sum duration is 153 seconds), and so this is where I would like a new waypoint created. Note that there are time intervals which will be so large that multiple 'new' waypoints have to be made / copied (e.g. WP 7 for a 2 minute interval). Three ways of calculating the new coordinates for this new waypoint from very precise to not so precise (in order of preference) are: 1) Basing the new waypoint coordinates on the relative 'time distance' to each waypoint of the two surrounding waypoints (therewith assuming a constant movement during the time interval). The 'time distance' bewteen WP3 and WPnew is (120-73) 47 seconds and the 'time distance' between WPnew and WP4 is (153-120) 33 seconds (whereas total time interval between WP3 and WP4 is 80 seconds). WPnew (with coordinates Xnew,Ynew) should then be located at 80/33*100=41.25% from WP3: Xnew = X3 + (X4-X3)*41.25% and Ynew= Y3 + (Y4-Y3)*41.25% 2) Calculate the average location (average of x3,y3 and x4,y4), at which to create a new waypoint at 2 minutes. 3) A simpler alternative is that the location of the 'closer waypoint in time', in this example WP 4, (WP4: 153-120=33 versus WP3: 120-73=47) could be copied as being the new location. I hope I explained my query so that it makes sense to you. I realize I am asking a 'big' question and apologize for this - the software programs I have thorough knowledge of (ArcGIS, excel, Mapsource), are all unable to solve this problem. I would be very grateful for any advice or suggestions. Best wishes, Louise [[alternative HTML version deleted]] ______________________________________________ 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.