Adehabitat Ltraj error message: "non unique dates for a given burst"

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Adehabitat Ltraj error message: "non unique dates for a given burst"

NickvanDoormaal
This post was updated on .
Hello everyone,

I'm trying to create a ltraj-class.
I start with importing an excel file containing all the relocations (in this case for the month March) into ArcMap and create a shapefile. Next I load the shapefile into R and transform the coordinates to UTM37S.

My dataset looks as follows:

head(march2012)
 coordinates                 ID                   Date_old       Longitude   Latitude     Date           
0 (496297, 9688770)  Emusaya_Male  2012-03-20   38.96668   -2.815783  2012-03-20 00:04
1 (496670, 9686680)  Emusaya_Male  2012-03-20   38.97003   -2.834650  2012-03-20 01:04
2 (497136, 9685230)  Emusaya_Male  2012-03-20   38.97423   -2.847833  2012-03-20 02:04
3 (497233, 9684700)  Emusaya_Male  2012-03-20   38.97510   -2.852633  2012-03-20 03:05
4 (497105, 9684290)  Emusaya_Male  2012-03-20   38.97395   -2.856317  2012-03-20 04:04
5 (497281, 9683830)  Emusaya_Male  2012-03-20   38.97553   -2.860467  2012-03-20 05:04

I used the following script:
da <- as.character(march2012$Date)
da <- as.POSIXct(strptime(as.character(march2012$Date),"%y-%m-%d  %H:%M"))
march2012df <- as.data.frame(march2012)
xymarch2012 <- coordinates(march2012)
elemarch2012 <- as.ltraj(xy =xymarch2012, date = da, id = march2012df$ID)

There error message I got was: "Error in as.ltraj(xy = xymarch2012, date = da, id = march2012df$ID) :
  non unique dates for a given burst".

Before posting this message, I read about duplicates. My dataset includes 10 different elephants, so it could be that some dates are the same. However, I would like to keep these locations because they are different individuals.

I hope I made my problem clear. If you need any more information, please let me know what kind of information and how to send it.

Kind regards,

Nick van Doormaal
MSc student Forest and Nature Conservation
Wageningen University, The Netherlands    
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Reply | Threaded
Open this post in threaded view
|

Re: Adehabitat Ltraj error message: "non unique dates for a given burst"

Mathieu Basille-3
Hi Nick,

You can try:

sum(duplicated(paste(da, march2012df$ID)))

and from there, if the sum is > 0, identify the duplicates *per individual*.

As far as I can tell, the function as.ltraj works at the burst level, in
your cases individuals.

Mathieu.


Le 11/20/2013 07:21 AM, Nick van Doormaal a écrit :

> Hello everyone,
>
> I'm trying to create a ltraj-class.
> I start with importing an excel file containing all the relocations (in this case for the month March) into ArcMap and create a shapefile. Next I load the shapefile into R and transform the coordinates to UTM37S.
>
> My dataset looks as follows:
>
> head(march2012)
>   coordinates                           ID                                       Date_old        Longitude   Latitude           Date
> 0 (496297, 9688770)  Emusaya_Male  2012-03-20   38.96668   -2.815783  2012-03-20 00:04
> 1 (496670, 9686680)  Emusaya_Male  2012-03-20   38.97003   -2.834650  2012-03-20 01:04
> 2 (497136, 9685230)  Emusaya_Male  2012-03-20   38.97423   -2.847833  2012-03-20 02:04
> 3 (497233, 9684700)  Emusaya_Male  2012-03-20   38.97510   -2.852633  2012-03-20 03:05
> 4 (497105, 9684290)  Emusaya_Male  2012-03-20   38.97395   -2.856317  2012-03-20 04:04
> 5 (497281, 9683830)  Emusaya_Male  2012-03-20   38.97553   -2.860467  2012-03-20 05:04
>
> I used the following script:
> da <- as.character(march2012$Date)
> da <- as.POSIXct(strptime(as.character(march2012$Date),"%y-%m-%d  %H:%M"))
> march2012df <- as.data.frame(march2012)
> xymarch2012 <- coordinates(march2012)
> elemarch2012 <- as.ltraj(xy =xymarch2012, date = da, id = march2012df$ID)
>
> There error message I got was: "Error in as.ltraj(xy = xymarch2012, date = da, id = march2012df$ID) :
>    non unique dates for a given burst".
>
> Before posting this message, I read about duplicates. My dataset includes 10 different elephants, so it could be that some dates are the same. However, I would like to keep these locations because they are different individuals.
>
> I hope I made my problem clear. If you need any more information, please let me know what kind of information and how to send it.
>
> Kind regards,
>
> Nick van Doormaal
> MSc student Forest and Nature Conservation
> Wageningen University, The Netherlands  
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

--

~$ whoami
Mathieu Basille, PhD

~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314
http://ase-research.org/basille

~$ fortune
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
  -- Paul Éluard

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Reply | Threaded
Open this post in threaded view
|

RE: Adehabitat Ltraj error message: "non unique dates for a given burst"

NickvanDoormaal
Thank you so much for your quick reply Mathieu!
 
I tried your suggestion:
sum(duplicated(paste(da, march2012df$ID)))
[1] 2587
 
I was surprised by this large number, so I checked how many rows many dataset has:
nrow(march2012)
[1] 2597
 
This almost exactly the same, only a difference of 10 (maybe because of the 10 individuals?).
It seems that all the dates are identified as duplicates...
 

 

Date: Wed, 20 Nov 2013 06:11:26 -0800
From: [hidden email]
To: [hidden email]
Subject: Re: Adehabitat Ltraj error message: "non unique dates for a given burst"

Hi Nick,

You can try:

sum(duplicated(paste(da, march2012df$ID)))

and from there, if the sum is > 0, identify the duplicates *per individual*.

As far as I can tell, the function as.ltraj works at the burst level, in
your cases individuals.

Mathieu.


Le 11/20/2013 07:21 AM, Nick van Doormaal a écrit :

> Hello everyone,
>
> I'm trying to create a ltraj-class.
> I start with importing an excel file containing all the relocations (in this case for the month March) into ArcMap and create a shapefile. Next I load the shapefile into R and transform the coordinates to UTM37S.
>
> My dataset looks as follows:
>
> head(march2012)
>   coordinates                           ID                                       Date_old        Longitude   Latitude           Date
> 0 (496297, 9688770)  Emusaya_Male  2012-03-20   38.96668   -2.815783  2012-03-20 00:04
> 1 (496670, 9686680)  Emusaya_Male  2012-03-20   38.97003   -2.834650  2012-03-20 01:04
> 2 (497136, 9685230)  Emusaya_Male  2012-03-20   38.97423   -2.847833  2012-03-20 02:04
> 3 (497233, 9684700)  Emusaya_Male  2012-03-20   38.97510   -2.852633  2012-03-20 03:05
> 4 (497105, 9684290)  Emusaya_Male  2012-03-20   38.97395   -2.856317  2012-03-20 04:04
> 5 (497281, 9683830)  Emusaya_Male  2012-03-20   38.97553   -2.860467  2012-03-20 05:04
>
> I used the following script:
> da <- as.character(march2012$Date)
> da <- as.POSIXct(strptime(as.character(march2012$Date),"%y-%m-%d  %H:%M"))
> march2012df <- as.data.frame(march2012)
> xymarch2012 <- coordinates(march2012)
> elemarch2012 <- as.ltraj(xy =xymarch2012, date = da, id = march2012df$ID)
>
> There error message I got was: "Error in as.ltraj(xy = xymarch2012, date = da, id = march2012df$ID) :
>    non unique dates for a given burst".
>
> Before posting this message, I read about duplicates. My dataset includes 10 different elephants, so it could be that some dates are the same. However, I would like to keep these locations because they are different individuals.
>
> I hope I made my problem clear. If you need any more information, please let me know what kind of information and how to send it.
>
> Kind regards,
>
> Nick van Doormaal
> MSc student Forest and Nature Conservation
> Wageningen University, The Netherlands  
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
--

~$ whoami
Mathieu Basille, PhD

~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314
http://ase-research.org/basille

~$ fortune
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
  -- Paul Éluard

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



To unsubscribe from Adehabitat Ltraj error message: "non unique dates for a given burst", click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Adehabitat Ltraj error message: "non unique dates for a given burst"

Mathieu Basille-3
Ah! I didn't spot that in the first place, but you gave a wrong format to
the strptime function! The one you gave implied a '12-03-20 00:04' format.
As a result, all of them returned NAs (well, almost all of them... Might be
worth looking at the ten that went through it).

You need to use %Y instead of %y.

Mathieu.


Le 11/21/2013 05:58 AM, NickvanDoormaal a écrit :

> Thank you so much for your quick reply Mathieu!
>
> I tried your suggestion:
> sum(duplicated(paste(da, march2012df$ID)))
> [1] 2587
>
> I was surprised by this large number, so I checked how many rows many dataset has:
> nrow(march2012)
> [1] 2597
>
> This almost exactly the same, only a difference of 10 (maybe because of the 10 individuals?).
> It seems that all the dates are identified as duplicates...
>
>
>
> Date: Wed, 20 Nov 2013 06:11:26 -0800
> From: [hidden email]
> To: [hidden email]
> Subject: Re: Adehabitat Ltraj error message: "non unique dates for a given burst"
>
>
>
> Hi Nick,
>
>
> You can try:
>
>
> sum(duplicated(paste(da, march2012df$ID)))
>
>
> and from there, if the sum is > 0, identify the duplicates *per individual*.
>
>
> As far as I can tell, the function as.ltraj works at the burst level, in
>
> your cases individuals.
>
>
> Mathieu.
>
>
>
> Le 11/20/2013 07:21 AM, Nick van Doormaal a écrit :
>
>> Hello everyone,
>
>>
>
>> I'm trying to create a ltraj-class.
>
>> I start with importing an excel file containing all the relocations (in this case for the month March) into ArcMap and create a shapefile. Next I load the shapefile into R and transform the coordinates to UTM37S.
>
>>
>
>> My dataset looks as follows:
>
>>
>
>> head(march2012)
>
>>    coordinates                           ID                                       Date_old        Longitude   Latitude           Date
>
>> 0 (496297, 9688770)  Emusaya_Male  2012-03-20   38.96668   -2.815783  2012-03-20 00:04
>
>> 1 (496670, 9686680)  Emusaya_Male  2012-03-20   38.97003   -2.834650  2012-03-20 01:04
>
>> 2 (497136, 9685230)  Emusaya_Male  2012-03-20   38.97423   -2.847833  2012-03-20 02:04
>
>> 3 (497233, 9684700)  Emusaya_Male  2012-03-20   38.97510   -2.852633  2012-03-20 03:05
>
>> 4 (497105, 9684290)  Emusaya_Male  2012-03-20   38.97395   -2.856317  2012-03-20 04:04
>
>> 5 (497281, 9683830)  Emusaya_Male  2012-03-20   38.97553   -2.860467  2012-03-20 05:04
>
>>
>
>> I used the following script:
>
>> da <- as.character(march2012$Date)
>
>> da <- as.POSIXct(strptime(as.character(march2012$Date),"%y-%m-%d  %H:%M"))
>
>> march2012df <- as.data.frame(march2012)
>
>> xymarch2012 <- coordinates(march2012)
>
>> elemarch2012 <- as.ltraj(xy =xymarch2012, date = da, id = march2012df$ID)
>
>>
>
>> There error message I got was: "Error in as.ltraj(xy = xymarch2012, date = da, id = march2012df$ID) :
>
>>     non unique dates for a given burst".
>
>>
>
>> Before posting this message, I read about duplicates. My dataset includes 10 different elephants, so it could be that some dates are the same. However, I would like to keep these locations because they are different individuals.
>
>>
>
>> I hope I made my problem clear. If you need any more information, please let me know what kind of information and how to send it.
>
>>
>
>> Kind regards,
>
>>
>
>> Nick van Doormaal
>
>> MSc student Forest and Nature Conservation
>
>> Wageningen University, The Netherlands  
>
>> [[alternative HTML version deleted]]
>
>>
>
>> _______________________________________________
>
>> R-sig-ecology mailing list
>
>> [hidden email]
>
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
>
>
> _______________________________________________
> R-sig-ecology mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

--

~$ whoami
Mathieu Basille, PhD

~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314
http://ase-research.org/basille

~$ fortune
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
  -- Paul Éluard

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Reply | Threaded
Open this post in threaded view
|

RE: Adehabitat Ltraj error message: "non unique dates for a given burst"

NickvanDoormaal
Wow, can't imagine that was actually the problem!
Thank you so much Mathieu for your help and quick replies!
 

Date: Thu, 21 Nov 2013 07:41:32 -0800
From: [hidden email]
To: [hidden email]
Subject: Re: Adehabitat Ltraj error message: "non unique dates for a given burst"

Ah! I didn't spot that in the first place, but you gave a wrong format to
the strptime function! The one you gave implied a '12-03-20 00:04' format.
As a result, all of them returned NAs (well, almost all of them... Might be
worth looking at the ten that went through it).

You need to use %Y instead of %y.

Mathieu.


Le 11/21/2013 05:58 AM, NickvanDoormaal a écrit :

> Thank you so much for your quick reply Mathieu!
>
> I tried your suggestion:
> sum(duplicated(paste(da, march2012df$ID)))
> [1] 2587
>
> I was surprised by this large number, so I checked how many rows many dataset has:
> nrow(march2012)
> [1] 2597
>
> This almost exactly the same, only a difference of 10 (maybe because of the 10 individuals?).
> It seems that all the dates are identified as duplicates...
>
>
>
> Date: Wed, 20 Nov 2013 06:11:26 -0800
> From: [hidden email]
> To: [hidden email]
> Subject: Re: Adehabitat Ltraj error message: "non unique dates for a given burst"
>
>
>
> Hi Nick,
>
>
> You can try:
>
>
> sum(duplicated(paste(da, march2012df$ID)))
>
>
> and from there, if the sum is > 0, identify the duplicates *per individual*.
>
>
> As far as I can tell, the function as.ltraj works at the burst level, in
>
> your cases individuals.
>
>
> Mathieu.
>
>
>
> Le 11/20/2013 07:21 AM, Nick van Doormaal a écrit :
>
>> Hello everyone,
>
>>
>
>> I'm trying to create a ltraj-class.
>
>> I start with importing an excel file containing all the relocations (in this case for the month March) into ArcMap and create a shapefile. Next I load the shapefile into R and transform the coordinates to UTM37S.
>
>>
>
>> My dataset looks as follows:
>
>>
>
>> head(march2012)
>
>>    coordinates                           ID                                       Date_old        Longitude   Latitude           Date
>
>> 0 (496297, 9688770)  Emusaya_Male  2012-03-20   38.96668   -2.815783  2012-03-20 00:04
>
>> 1 (496670, 9686680)  Emusaya_Male  2012-03-20   38.97003   -2.834650  2012-03-20 01:04
>
>> 2 (497136, 9685230)  Emusaya_Male  2012-03-20   38.97423   -2.847833  2012-03-20 02:04
>
>> 3 (497233, 9684700)  Emusaya_Male  2012-03-20   38.97510   -2.852633  2012-03-20 03:05
>
>> 4 (497105, 9684290)  Emusaya_Male  2012-03-20   38.97395   -2.856317  2012-03-20 04:04
>
>> 5 (497281, 9683830)  Emusaya_Male  2012-03-20   38.97553   -2.860467  2012-03-20 05:04
>
>>
>
>> I used the following script:
>
>> da <- as.character(march2012$Date)
>
>> da <- as.POSIXct(strptime(as.character(march2012$Date),"%y-%m-%d  %H:%M"))
>
>> march2012df <- as.data.frame(march2012)
>
>> xymarch2012 <- coordinates(march2012)
>
>> elemarch2012 <- as.ltraj(xy =xymarch2012, date = da, id = march2012df$ID)
>
>>
>
>> There error message I got was: "Error in as.ltraj(xy = xymarch2012, date = da, id = march2012df$ID) :
>
>>     non unique dates for a given burst".
>
>>
>
>> Before posting this message, I read about duplicates. My dataset includes 10 different elephants, so it could be that some dates are the same. However, I would like to keep these locations because they are different individuals.
>
>>
>
>> I hope I made my problem clear. If you need any more information, please let me know what kind of information and how to send it.
>
>>
>
>> Kind regards,
>
>>
>
>> Nick van Doormaal
>
>> MSc student Forest and Nature Conservation
>
>> Wageningen University, The Netherlands  
>
>> [[alternative HTML version deleted]]
>
>>
>
>> _______________________________________________
>
>> R-sig-ecology mailing list
>
>> [hidden email]
>
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
>
>
> _______________________________________________
> R-sig-ecology mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
--

~$ whoami
Mathieu Basille, PhD

~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314
http://ase-research.org/basille

~$ fortune
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
  -- Paul Éluard

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



To unsubscribe from Adehabitat Ltraj error message: "non unique dates for a given burst", click here.
NAML