[R-sig-eco] Strange calculation of dt in adehabitat

Mathieu Basille basille at ase-research.org
Thu Jul 15 20:51:03 CEST 2010


Anders,

I run into the exact same problem because of DST. As you said that it 
was GPS data, it is safe to explicitly set up the timezone to GMT (or to 
any other timezone *without* DST that better suits your needs) at the 
importation step. For example, try:

as.POSIXct(strptime(points$LMT_Date, format = "%Y-%m-%d %H:%M:%S", tz = 
"GMT")) ## Check out the exact 'format' here

And then have a look again at your results. The problem comes from 
as.POSIXct which assumes, if not stated otherwise, that times are in 
your locale (i.e. LC_TIME=Swedish_Sweden.1252, I guess with DST). And 
the output of the trajectory does not tell you the actual timezone. To 
be sure of this, try:

points$LMT_Date[6]
points$LMT_Date[7]

The second time should be with DST. Alternatively, you can use the 
modified function attached, which shows you, in a ltraj summary, the 
timezone of the different bursts.

Hope this helps,
Mathieu.


Anders Kagervall a écrit :
> Hi Matt,
> 
>> From: Matt Beard [mailto:biozealot21 at gmail.com] 
>> Sent: den 10 juli 2010 04:35
>> To: Anders Kagervall
>> Cc: r-sig-ecology at r-project.org
>> Subject: Re: [R-sig-eco] Strange calculation of dt in adehabitat
>>
>> Anders,
> 
>> I was not able to recreate your problem with the demo you provided. What are the details of your platform? 
> 
> Here is my sessionInfo()
> R version 2.10.1 (2009-12-14) 
> i386-pc-mingw32 
> 
> locale:
> [1] LC_COLLATE=Swedish_Sweden.1252  LC_CTYPE=Swedish_Sweden.1252   
> [3] LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C                   
> [5] LC_TIME=Swedish_Sweden.1252    
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base     
> 
> other attached packages:
> [1] gpclib_1.5-1     adehabitat_1.8.3 ade4_1.4-14     
> 
> I also ran the test with Linux and R 2.11.1 and got the same results.
> However, your comment made me think a little further and I'm now pretty sure that the problem comes from the fact that 2008-10-26 was a date when we changed from daylight savings time to normal time. I tested by replacing the month from  10 to 09 in the data file and got results without any missing points.
> I'm still not sure if the problem I see is in how we record time in our database or how adehabitat calculates the time interval.  I will re-run the analyze using GMT-datetime, that we also have in the database, and see if I can get rid of the problem.
> 
> ps
> Your assumption about the precision of the X and Y coordinates was correct. I have now attached the actual data file I used.
> ds 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

-- 

~$ whoami
Mathieu Basille, Post-Doc

~$ locate
Laboratoire d'Écologie Comportementale et de Conservation de la Faune
+ Centre d'Étude de la Forêt
Département de Biologie
Université Laval, Québec

~$ info
http://ase-research.org/basille

~$ fortune
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: summary.ltraj.R
URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20100715/3d752ac6/attachment.pl>


More information about the R-sig-ecology mailing list