[R-sig-eco] as.ltraj and fpt from AdeHabitat

Mathieu Basille basille at biomserv.univ-lyon1.fr
Wed Apr 28 16:17:46 CEST 2010


Dear Samantha,

Sorry I just found the thread now. Do you still have this problem? If 
your problem comes from the ltraj itself (as.ltraj function), you need 
to provide more details about what do you have in FPT, dddate and tttime 
(although the dates seems fine regarding your outputs), so that we can 
understand what's going on.

The sample you showed for the ltraj looks like the last relocation of a 
trajectory, with NAs for every movement parameter (but a R2n = 0 would 
indicate that this is the exact same localisation as the first one).

Please provide the output of:

str(FPT)
head(FPT)
str(dddate)
head(dddate)
str(tttime)
head(tttime)

In addition to David's comment on fpt, it would probably be a good idea 
to project your coordinates if they are initially in long/lat (use 
package rgdal for this) before building the ltraj (dx, dy, dist, ... 
make more sense to me in projected units, e.g. meters).

Cheers,
Mathieu.



Pinaud David a écrit :
> Dear Sam,
> Maybe one idea is that XY units are in decimal degrees but you asked for 
> radii=seq(300,1000,length=30), which seem to be in meters. As fpt() uses 
> the same units as yaya coords, it seems that it returns FPT for radii 
> from 300 to 1000 decimal degrees, possibly NAs... It seems that you need 
> to project your data in m or km before using fpt().
> Be aware also that FPT needs to be calculated every /d/ constant 
> distance (not raw relocations) as mentionned in Fauchald & Tveraa 
> (2003), so use redisltraj() before fpt().
> HTH
> David
> 
> Samantha Patrick a écrit :
>> Hi
>>
>> I am using adehabitat to calculate first passage time (fpt) for a 
>> series of GPS locations at a specific date and time.
>>
>> When I use as.ltraj to workout trajectories the output I get for each 
>> data point looks like this:
>>
>> x                     y                 
>> date                                     dx   dy   dist  dt    R2n    
>> abs.angle    rel.angle
>> -6.070993  51.59435  2006-06-17 15:03:04     NA  NA  NA   NA   
>> 0        NA      102        NA
>>
>> When I use fpt I get a series of NA for all points and I'm guessing 
>> this is to do with the NAs for dx/dy/dt from ltraj.  Does anyone know 
>> what may be causing this error?
>>
>> The full code is below
>>
>> Thanks!
>>
>> Sam
>>
>> FOR LTRAJ
>> str(dddate)
>> dddate<-as.character(dddate)
>> str(dddate)
>> tttime<-as.character(tttime)
>> datetime<-paste(dddate, tttime)
>> ddate <- as.POSIXct(datetime)
>> xy<-data.frame (x, y)
>> id<-data.frame (FPT[,5])
>> xy<-data.frame (FPT[,4], FPT[,3])
>> yaya<-as.ltraj(xy,ddate,id, burst, typeII = TRUE, slsp = c("remove", 
>> "missing"))
>>
>> FOR FPT
>> fptyaya=fpt(yaya, seq(300,1000,length=30))
>>
>>
>>
>> Dr Samantha Patrick
>> EU INTERREG Post Doc
>> Marine Biology & Ecology Research Centre
>> University of Plymouth
>> Plymouth
>> PL4 8AA
>>
>> T: 01752 584699
>> M: 07740472719
>>
>>
>>     [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>>
>> __________ Information from ESET Mail Security, version of virus 
>> signature database 4979 (20100328) __________
>>
>> The message was checked by ESET Mail Security.
>> http://www.eset.com
>>
>>
>>
>>
>>
>>   
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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.



More information about the R-sig-ecology mailing list