Nicolas,
I have checked the latitude and longitude, they are not factors but numeric.
I have made a sample of the data for you to look at if you have time. It
includes 3 individuals (A, B, C). Hopefully you can help me understand what
the problem is, because I have been at it for almost a day and I still feel
like I am not any closer to finding a solution!!
Thanks so much for your help! It's much appreciated!
Elodie
Elodie Camprasse
6/187 Auburn Road
Hawthorn, VIC 3122
Australia
Email: [email protected]
Website: http://hors-des-sentiers-battus.e-monsite.com/
Mobile: (+61) 049 794 0793
-----Original Message-----
From: AniMov [mailto:[email protected]] On Behalf Of
[email protected]
Sent: Tuesday, 8 July 2014 8:00 PM
To: [email protected]
Subject: AniMov Digest, Vol 101, Issue 2
Send AniMov mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific than
"Re: Contents of AniMov digest..."
Today's Topics:
1. Re: AniMov Digest, Vol 101, Issue 1 (Elodie Camprasse)
2. Re: AniMov Digest, Vol 101, Issue 1 (Morellet Nicolas)
----------------------------------------------------------------------
Message: 1
Date: Tue, 8 Jul 2014 19:31:42 +1000
From: "Elodie Camprasse" <[email protected]>
To: <[email protected]>
Subject: Re: [AniMov] AniMov Digest, Vol 101, Issue 1
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Nicolas,
Thanks heaps for the quick reply! Turns out, in the meantime I finally
realized that my id column for some reasons contained 21 levels instead of
20 (I have 20 individuals) (the problem occurred because one of the level
was "id", ie the column name, even though I am not sure how that
happened...). So I fixed this problem and now my id column is alright (with
20 levels as I wanted); however, now when I run the code again, it comes up
with a new error: " Error in as.ltraj(xy = data[, c("X.Latitude",
"X.Longitude")], date = data$timestamp, : non unique dates for a given
burst".
I have looked at the forums and saw that this situation could occur when the
date format was not set right (e.g. %y instead of %y) but I carefully
checked my format and cannot see any mistake there!
Here is my new code
#set working directory
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)
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=T) ## FOR SOME
REASON, I do not understand why R as automoatically put an "X"
in front of some column names (like Date, Time, Latitude, Longitude) but not
in front of all of #them (the column name for id stayed as is...) so I just
used the names as they appeared in my data frame...
timestamp <- as.POSIXct(strptime(as.character(paste(data$X.Date,
data$X.Time)),"%Y/%m/%d %H:%M:%S"), "GMT") data <- data.frame(data,
timestamp = timestamp) everybody<-as.ltraj(xy =
data[,c("X.Latitude","X.Longitude")], date = data$timestamp, id = data$id)
Perhaps it could help if I included some of the data so you can see how it
looks like:
id Index X.Date X.Time X.Latitude X.Longitude X.Speed
X.Course X.Distance X.EHPE timestamp
LB-LP0009-(2) 38 2013/10/15 05:09:35 -38.621288
142.933365 0 348 0 5072 15/10/2013 5:09
LB-LP0009-(2) 39 2013/10/15 05:11:39 -38.618813
142.935715 0 36 342.725368 4768 15/10/2013 5:11
LB-LP0009-(2) 40 2013/10/15 05:13:49 -38.619331
142.9366 7344 243 96.122993 4768 15/10/2013 5:13
Thanks for letting me know if you can think of a way to fix this!
P-S: Fyi, when I apply the drop_level on the code as it was before I fixed
the number of levels, I got this:
warnings()
Warning messages:
1: In Ops.factor(x1$x, x2$x) : - not meaningful for factors
2: In Ops.factor(x1$y, x2$y) : - not meaningful for factors
3: In Ops.factor(x$x, x$x[1]) : - not meaningful for factors
4: In Ops.factor(x$y, x$y[1]) : - not meaningful for factors
5: In Ops.factor(x1$x, x2$x) : - not meaningful for factors
6: In Ops.factor(x1$y, x2$y) : - not meaningful for factors...... There were
50 or more warnings.
Elodie Camprasse
6/187 Auburn Road
Hawthorn, VIC 3122
Australia
Email:[email protected]
Website:?http://hors-des-sentiers-battus.e-monsite.com/
Mobile:?(+61) 049 794 0793?
-----Original Message-----
From: AniMov [mailto:[email protected]] On Behalf Of
[email protected]
Sent: Tuesday, 8 July 2014 7:07 PM
To: [email protected]
Subject: AniMov Digest, Vol 101, Issue 1
Send AniMov mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific than
"Re: Contents of AniMov digest..."
Today's Topics:
1. Cannot create ltraj object (Elodie Camprasse)
2. Re: Cannot create ltraj object (Morellet Nicolas)
----------------------------------------------------------------------
Message: 1
Date: Tue, 8 Jul 2014 18:21:40 +1000
From: "Elodie Camprasse" <[email protected]>
To: <[email protected]>
Subject: [AniMov] Cannot create ltraj object
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"
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:[email protected]> [email protected]
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/att
achment-0001.html>
------------------------------
Message: 2
Date: Tue, 08 Jul 2014 11:06:54 +0200
From: Morellet Nicolas <[email protected]>
To: [email protected]
Subject: Re: [AniMov] Cannot create ltraj object
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Hello Elodie,
Could you try ?
data_used = droplevels(data_used)
Maybe some individuals are present in the id variable (if this is a factor
variable) but with missing component(s).
Cheers,
Nicolas.
Le 08/07/2014 10:21, Elodie Camprasse a ?crit :
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: [email protected] <mailto:[email protected]>
Website: http://hors-des-sentiers-battus.e-monsite.com/
Mobile: (+61) 049 794 0793 <tel:%28%2B61%29%20049%20794%200793>
_______________________________________________
AniMov mailing list
[email protected]
http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov
_______________________________________________
AniMov mailing list
[email protected]
http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov