[R-sig-eco] Adehabitat Ltraj error message: "non unique dates for a given burst"

Mathieu Basille basille.web at ase-research.org
Thu Nov 21 16:40:16 CET 2013


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: ml-node+s471788n7578529h52 at n2.nabble.com
> To: nickvandoormaal26 at hotmail.com
> 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
> R-sig-ecology at r-project.org
> 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



More information about the R-sig-ecology mailing list