Issue with ltraj function in R for movement analysis
Hi, A few issues here. From your code it appears that the date you are feeding as.ltraj is not unique (140403). You need to combine date and time then convert to POSIXct. Another thing is that, as written, das is a character vector (das <- as.character(data$NewDate)) which is what is being fed to as.ltraj. You define das again as: das <- as.POSIXct(strptime(as.character(data$NewDate). This should be throwing an error since you did not give the format for strptime. To rediscretize temporally or spatially see ?redisltraj. -------------------------------------------------------- Jason G. Romine, Ph.D. USGS Western Fisheries Research Center 5501A Cook-Underwood Road Cook, WA 98605 Email:jromine at usgs.gov Website: http://wfrc.usgs.gov ---------------------------------------------------------
On Sun, Feb 8, 2015 at 7:19 PM, alittle <alittle139 at gmail.com> wrote:
I'm currently working on an first-passage time analysis under the
adehabitatLT package. To begin, I'm trying to bring my data into R and run
a
simple set of movement metrics output by the ltraj function. My data
consists of individual animal IDs, date, time, and x,y coordinates. I
followed the adehabitatLT vignette but continue to get the following error:
Error in as.ltraj(xy = data[, c("X", "Y")], date = das, id = data$NewID2,
:
non unique dates for a given burst
My data is structured as follows:
*NewID2 NewDate Time X Y*
1401FR141732 140403 6:57:00 PM 111111 2222222
1401FR141732 140403 7:37:00 PM 111123 2222243
1401FR141732 140403 7:57:00 PM 111135 2222264
1401FR141732 140403 8:17:00 PM 111147 2222285
1401FR141732 140403 8:37:00 PM 111159 2222306
1401FR141732 140403 8:57:00 PM 111171 2222327
1401FR141732 140403 9:17:00 PM 111183 2222348
1401FR141732 140403 9:37:00 PM 111195 2222369
1401FR141732 140403 9:57:00 PM 111207 2222390
1401FR141732 140403 10:17:00 PM 111219 2222411
1401FR141732 140403 10:37:00 PM 111231 2222432
1401FR141732 140403 11:17:00 PM 111243 2222453
*R-code: *
data<-read.csv("FPT_Ready_for_R_282015.csv")
head(data)
das <- as.character(data$NewDate)
head(das)
das <- as.POSIXct(strptime(as.character(data$NewDate)
newcoon <- as.ltraj(xy = data[,c("X","Y")], date = das, id=data$NewID2,
burst=data$NewID2,typeII = TRUE)
The NewID2 was designed to be a unique ID for a unique first-passage time
run and date. However, I continue to receive the same error about non
unique
dates for a given burst. This doesn't make sense given that I have a
specific run for one animal on a specific date with individual times for
each location. This coding doesn't seem to take into account the time
between successive locations. Maybe I'm missing something.
Additionally, the data is based on VHF locations; therefore, the time lag
between successive locations is irregular. I eventually need to interpolate
locations every 1-m along the path for the first-passage time analysis and
I'm unclear on the exact process of how to do this using adehabitatLT.
I appreciate any help on my issues. Thank you!
--
View this message in context:
http://r-sig-ecology.471788.n2.nabble.com/Issue-with-ltraj-function-in-R-for-movement-analysis-tp7579295.html
Sent from the r-sig-ecology mailing list archive at Nabble.com.
_______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology