[R-sig-eco] Issue with ltraj function in R for movement analysis

alittle alittle139 at gmail.com
Mon Feb 9 16:33:45 CET 2015


One suggestion that I got was to change the date/time column by concatenating
them. I tried this step with little luck. Here's the new R code and example
of my data set structure: 

#Load Data for First Passage Time Analysis
data<-read.csv("FPT_Ready_for_R_282015.csv")
head(data)

das <- as.character(data$DateTime)
head(das)  

#Use the function strptime (see the help page of this function) to convert
the date in locs into 
#a POSIXlt object, as then as.POSIXct to convert it into the class POSIXct: 

das <- as.POSIXct(strptime(as.character(data$DateTime),"%M/%dd/%yyyy
%hh:%mm:%ss"))  #We can then create an object of class ltraj to store the
animal movements

#Calculate animal movements
datanew <- as.ltraj(xy = data[,c("X","Y")], date = das,id=data$NewID2,
burst=data$NewID2)
datanew

This is the error that I received: 
Error in as.ltraj(xy = data[, c("X", "Y")], date = das, id = data$NewID2,  : 
  non unique dates for a given burst

I've searched the data set and cannot find any duplicate values for dates
because I combined both date and time and with the inclusion of the unique
ID I shouldn't have any problems. Any suggestions? Thank you! 

ID	  Group_ID NewID2	       DateTime	       X	  Y
1401	FR1	1401FR141732	4/3/2014 18:57	111123	1111111
1401	FR1	1401FR141732	4/3/2014 19:37	111126	1111123
1401	FR1	1401FR141732	4/3/2014 19:57	111129	1111135
1401	FR1	1401FR141732	4/3/2014 20:17	111132	1111147
1401	FR1	1401FR141732	4/3/2014 20:37	111135	1111159
1401	FR1	1401FR141732	4/3/2014 20:57	111138	1111171
1401	FR1	1401FR141732	4/3/2014 21:17	111141	1111183
1401	FR1	1401FR141732	4/3/2014 21:37	111144	1111195
1401	FR1	1401FR141732	4/3/2014 21:57	111147	1111207
1401	FR1	1401FR141732	4/3/2014 22:17	111150	1111219
1401	FR1	1401FR141732	4/3/2014 22:37	111153	1111231
1401	FR2	1401FR241765	5/6/2014 19:20	111156	1111243
1401	FR2	1401FR241765	5/6/2014 19:40	111159	1111255
1401	FR2	1401FR241765	5/6/2014 20:00	111162	1111267
1401	FR2	1401FR241765	5/6/2014 20:20	111165	1111279
1401	FR2	1401FR241765	5/6/2014 20:40	111168	1111291
1401	FR2	1401FR241765	5/6/2014 21:01	111171	1111303
1401	FR2	1401FR241765	5/6/2014 21:20	111174	1111315
1401	FR2	1401FR241765	5/6/2014 21:40	111177	1111327
1401	FR2	1401FR241765	5/6/2014 22:01	111180	1111339
1401	FR2	1401FR241765	5/6/2014 22:20	111183	1111351
1401	FR2	1401FR241765	5/6/2014 22:41	111186	1111363
1401	FR2	1401FR241765	5/6/2014 23:26	111189	1111375
1401	FR2	1401FR241765	5/6/2014 23:42	111192	1111387
1401	FR2	1401FR241765	5/6/2014 0:01	111195	1111399
1401	FR2	1401FR241765	5/6/2014 0:20	111198	1111411
1401	FR2	1401FR241765	5/6/2014 1:00	111201	1111423
1401	FR2	1401FR241765	5/6/2014 1:20	111204	1111435



--
View this message in context: http://r-sig-ecology.471788.n2.nabble.com/Issue-with-ltraj-function-in-R-for-movement-analysis-tp7579295p7579297.html
Sent from the r-sig-ecology mailing list archive at Nabble.com.



More information about the R-sig-ecology mailing list