[AniMov] Cannot create ltraj object
elodie.camprasse at gmail.com
Tue Jul 8 10:21:40 CEST 2014
I have been encountering a problem when using the adehabitatLT package and
specifically the function as.ltraj and I was hoping someone could give me a
clue on how to solve the problem!
I am working with GPS data. I have got 20 different files with tracks that I
have merged together; it looks like I have successfully created a POSIXct
column that I added to the dataframe and I have one column with latitude and
one with longitude, as well as an ID column that has the ID of my individual
birds; however, when I use the as.ltraj function, I get the following error:
"Error in as.ltraj(xy = data_used[, c("latitude", "longitude")], date =
some id's are not present in the data"
I tried different things (without naming the columns first and with column
names, with or without "-" in the ID numbers, using just the relevant
columns with no additional information.) and nothing is fixing the problem.
I also do not understand the error message because when I check the length
of the relevant columns, there are the same.
Here is my code:
setwd("C:/Users/Elodie/Documents/Deakin/Data analysis/GPS data
analysis/Processed LB multiple tracks")
#merge all the files in the working directory in one dataframe
dataset = rbindlist(lapply( file_list, fread ))
write.csv(dataset, file = "dataset_multiple_trips_LB.csv", row.names = F)
#V3 is the Date column, V4 is the Time column
timestamp <- as.POSIXct(strptime(as.character(paste(data_used$V3,
data_used$V4)),"%Y/%m/%d %H:%M:%S"), "GMT")
data_used <- data.frame(data_used, V11 = timestamp)
colnames(data_used)<-c("id", "index", "date", "time", "latitude",
"longitude", "speed", "course", "distance", "EHPE", "timestamp")
everybody<-as.ltraj(xy = data_used[,c("latitude","longitude")], date =
data_used$timestamp, id = data_used$id)
Error in as.ltraj(xy = data_used[, c("latitude", "longitude")], date =
some id's are not present in the data
If I do the following code, I get the following results
Thanks in advance for pointing me in the right direction!
6/187 Auburn Road
Hawthorn, VIC 3122
Email: <mailto:elodie.camprasse at gmail.com> elodie.camprasse at gmail.com
Mobile: <tel:%28%2B61%29%20049%20794%200793> (+61) 049 794 0793
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AniMov