[AniMov] Cannot create ltraj object

Elodie Camprasse elodie.camprasse at gmail.com
Tue Jul 8 10:21:40 CEST 2014


Folks, 

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 =
data_used$timestamp,  : 

  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")

file_list<-list.files(pattern="*.csv", full.names=TRUE)

require(data.table)

#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)

data<-read.csv("dataset_multiple_trips_LB.csv", header=F)

data_used<-data[-1,]

#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 =
data_used$timestamp,  : 
  some id's are not present in the data

 

If I do the following code, I get the following results

> length(data_used$id)
[1] 14444
> length(data_used$timestamp)
[1] 14444
> length(data_used$longitude)
[1] 14444
> length(data_used$latitude)
[1] 14444. 

 

Thanks in advance for pointing me in the right direction! 
Elodie

 

Elodie Camprasse

6/187 Auburn Road

Hawthorn, VIC 3122

Australia 

 

Email:  <mailto:elodie.camprasse at gmail.com> elodie.camprasse at gmail.com

Website:  <http://hors-des-sentiers-battus.e-monsite.com/>
http://hors-des-sentiers-battus.e-monsite.com/

Mobile:  <tel:%28%2B61%29%20049%20794%200793> (+61) 049 794 0793 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.faunalia.it/pipermail/animov/attachments/20140708/180cd72f/attachment.html>


More information about the AniMov mailing list