Hi, I'm trying to subsample GPS collar data to replicate the position frequency of older collars and have been running into an error when using subsample() on a trajectory. I'm hoping someone might be able to provide some guidance.
The original GPS data set looks like this: > junk[1:10, c(1:3,14:15, 24) ] RecIDNew BrID Date x y IDBrYrSsn 297 297 X12156 13/12/2007 5:00:00 1188846 13247936 X12156_2008_Winter 298 298 X12156 13/12/2007 9:00:00 1193456 13250036 X12156_2008_Winter 299 299 X12156 13/12/2007 13:00:00 1196286 13259320 X12156_2008_Winter 300 300 X12156 13/12/2007 17:00:00 1196592 13262720 X12156_2008_Winter 301 301 X12156 14/12/2007 1:00:00 1192298 13273493 X12156_2008_Winter 302 302 X12156 14/12/2007 5:00:00 1190678 13285359 X12156_2008_Winter 303 303 X12156 14/12/2007 9:01:00 1190813 13293345 X12156_2008_Winter 304 304 X12156 14/12/2007 13:00:00 1192753 13289709 X12156_2008_Winter 305 305 X12156 14/12/2007 17:01:00 1194743 13287344 X12156_2008_Winter 306 306 X12156 15/12/2007 5:00:00 1197650 13318058 X12156_2008_Winter I have created the trajectory from the GPS data using the following code da<- as.POSIXct(strptime(as.character(junk$Date), "%d/%m/%Y %X")) tr <- as.ltraj(xy, da, id=junk$IDBrYrSsn, typeII = TRUE, slsp="missing") # Fill in missing values and make the trajectory regular tr2 <- setNA(tr, tr[[1]]$date[1], dt=4, units="hour") is.regular(tr2) > FALSE refda <- tr2[[1]]$date[1] tr3 <- sett0(tr2, refda, 4, units="hour") is.regular(tr3) > TRUE the output trajectory looks like this: >head(tr3[[1]]) x y date dx dy dist dt R2n abs.angle rel.angle 1 1188846 13247936 2007-12-13 05:00:00 4609.74 2099.89 5065.495 14400 0 0.4274459 NA 2 1193456 13250036 2007-12-13 09:00:00 2829.68 9284.29 9705.933 14400 25659241 1.2749586 0.8475127 3 1196286 13259320 2007-12-13 13:00:00 306.75 3399.73 3413.541 14400 184944524 1.4808122 0.2058536 4 1196592 13262720 2007-12-13 17:00:00 NA NA NA 14400 278567145 NA NA 5 NA NA 2007-12-13 21:00:00 NA NA NA 14400 NA NA NA 6 1192298 13273493 2007-12-14 01:00:00 -1619.99 11865.87 11975.944 14400 665047612 1.7064826 NA When I use subsample I encounter the following: tr3.sub <- subsample(tr3, dt = 3600*24*6, units="sec") # to subsample one location every 6 days Error in res[, names(res) %in% which, drop = FALSE] : incorrect number of dimensions If anybody has encountered this error before and can provide some advice on what step(s) i might be missing or any other thoughts on the error I would greatly appreciate your help. Thanks very much, Steven
_______________________________________________ AniMov mailing list AniMov@faunalia.it http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov