[AniMov] AniMov Digest, Vol 101, Issue 5

Morellet Nicolas Nicolas.Morellet at toulouse.inra.fr
Tue Jul 8 13:25:29 CEST 2014


OK.
If you want to check repetition for at the same timestam, you have to do 
it by individuals like for example:
table(table(data$timestamp,data$id)>1)
Nicolas.

Le 08/07/2014 13:17, Elodie Camprasse a écrit :
> Thanks so much for having a look! I'll get working from there and try to see
> at what point the problems start occurring! Hopefully I can find the
> solution!
> Elodie
>
> Elodie Camprasse
> 6/187 Auburn Road
> Hawthorn, VIC 3122
> Australia
>
> Email: elodie.camprasse at gmail.com
> Website: http://hors-des-sentiers-battus.e-monsite.com/
> Mobile: (+61) 049 794 0793
>
> -----Original Message-----
> From: AniMov [mailto:animov-bounces at faunalia.it] On Behalf Of
> animov-request at faunalia.it
> Sent: Tuesday, 8 July 2014 9:06 PM
> To: animov at faunalia.it
> Subject: AniMov Digest, Vol 101, Issue 5
>
> Send AniMov mailing list submissions to
> 	animov at faunalia.it
>
> 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
> 	animov-request at faunalia.it
>
> You can reach the person managing the list at
> 	animov-owner at faunalia.it
>
> 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 2 (Morellet Nicolas)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 08 Jul 2014 13:05:31 +0200
> From: Morellet Nicolas <Nicolas.Morellet at toulouse.inra.fr>
> To: animov at faunalia.it
> Subject: Re: [AniMov] AniMov Digest, Vol 101, Issue 2
> Message-ID: <53BBD07B.7000903 at toulouse.inra.fr>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> Hi,
>
> I have absolutely no problem with your short data frame.
> I wonder if you really need all these steps but I have no error.
>
> head(everybody)
>
> *********** List of class ltraj ***********
>
> Type of the traject: Type II (time recorded) Irregular traject. Variable
> time lag between two locs
>
> Characteristics of the bursts:
>     id burst nb.reloc NAs          date.begin            date.end
> 1  A     A       18   0 2013-10-15 05:09:35 2013-10-15 05:45:27
> 2  B     B       18   0 2013-10-15 18:05:35 2013-10-15 18:49:31
> 3  C     C       15   0 2013-11-19 18:11:01 2013-11-19 18:54:26
>
>
>    infolocs provided. The following variables are available:
> [1] "pkey"
>
>
> To check the repetition on the same date you can use:
> table(table(timestamp)>1)
>
> Cheers,
> Nicolas.
>
>
> Le 08/07/2014 12:23, Elodie Camprasse a ?crit :
>> 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: elodie.camprasse at gmail.com
>> Website: http://hors-des-sentiers-battus.e-monsite.com/
>> Mobile: (+61) 049 794 0793
>>
>> -----Original Message-----
>> From: AniMov [mailto:animov-bounces at faunalia.it] On Behalf Of
>> animov-request at faunalia.it
>> Sent: Tuesday, 8 July 2014 8:00 PM
>> To: animov at faunalia.it
>> Subject: AniMov Digest, Vol 101, Issue 2
>>
>> Send AniMov mailing list submissions to
>> 	animov at faunalia.it
>>
>> 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
>> 	animov-request at faunalia.it
>>
>> You can reach the person managing the list at
>> 	animov-owner at faunalia.it
>>
>> 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" <elodie.camprasse at gmail.com>
>> To: <animov at faunalia.it>
>> Subject: Re: [AniMov] AniMov Digest, Vol 101, Issue 1
>> Message-ID: <01b201cf9a8f$6f6eb1c0$4e4c1540$@gmail.com>
>> 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:?elodie.camprasse at gmail.com
>> Website:?http://hors-des-sentiers-battus.e-monsite.com/
>> Mobile:?(+61) 049 794 0793?
>>
>> -----Original Message-----
>> From: AniMov [mailto:animov-bounces at faunalia.it] On Behalf Of
>> animov-request at faunalia.it
>> Sent: Tuesday, 8 July 2014 7:07 PM
>> To: animov at faunalia.it
>> Subject: AniMov Digest, Vol 101, Issue 1
>>
>> Send AniMov mailing list submissions to
>> 	animov at faunalia.it
>>
>> 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
>> 	animov-request at faunalia.it
>>
>> You can reach the person managing the list at
>> 	animov-owner at faunalia.it
>>
>> 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" <elodie.camprasse at gmail.com>
>> To: <animov at faunalia.it>
>> Subject: [AniMov] Cannot create ltraj object
>> Message-ID: <019c01cf9a85$a6f314b0$f4d93e10$@gmail.com>
>> 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: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/180cd7
>> 2f/att
>> achment-0001.html>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Tue, 08 Jul 2014 11:06:54 +0200
>> From: Morellet Nicolas <Nicolas.Morellet at toulouse.inra.fr>
>> To: animov at faunalia.it
>> Subject: Re: [AniMov] Cannot create ltraj object
>> Message-ID: <53BBB4AE.9000202 at toulouse.inra.fr>
>> 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: elodie.camprasse at gmail.com <mailto:elodie.camprasse at gmail.com>
>>>
>>> Website: http://hors-des-sentiers-battus.e-monsite.com/
>>>
>>> Mobile: (+61) 049 794 0793 <tel:%28%2B61%29%20049%20794%200793>
>>>
>>>
>>>
>>> _______________________________________________
>>> AniMov mailing list
>>> AniMov at faunalia.it
>>> http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov
>>
>>
>> _______________________________________________
>> AniMov mailing list
>> AniMov at faunalia.it
>> http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov
>


-- 


**********************************************************
                    Nicolas MORELLET
I.N.R.A. - Centre de Recherches de Toulouse
Comportement et Écologie de la Faune Sauvage (C.E.F.S.)
BP 52627 - 31326 Castanet-Tolosan cedex (France)
               Tel :  05.61.28.51.28
               Fax :  05.61.28.55.00
**********************************************************


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com



More information about the AniMov mailing list