[AniMov] FPT help

Mathieu Basille basille at ase-research.org
Tue Feb 1 01:12:48 CET 2011


Sorry, there is a mistake in the code: should be 'times' instead of
'each' in the rep line:

bla$burst <- rep(burst(puechcirc), times = na)

Mathieu.



Le 2011-01-31 19:04, Adam T. Ford a écrit :
> gorgeous code Mathieu, thanks much!
> 
> On Mon, Jan 31, 2011 at 4:13 PM, Mathieu Basille
> <basille at ase-research.org <mailto:basille at ase-research.org>> wrote:
> 
>     The difference comes from the NA (fpt first removes any NAs in the
>     coordinates).
> 
>     Something along that line should work:
> 
>     data(puechcirc)
>     i <- fpt(puechcirc, seq(300,1000, length=30))
>     bla <- do.call(rbind, i)
> 
>     na <- unlist(lapply(puechcirc, function(i) sum(!is.na
>     <http://is.na>(i[, 1]))))
>     bla$burst <- rep(burst(puechcirc), each = na)
> 
> 
>     Hope this helps,
>     Mathieu.
> 
> 
>     Le 2011-01-31 18:04, Adam T. Ford a écrit :
>     > Hello Mathieu and Animovers,
>     >
>     > Thank you for that reply and your interest.
>     > You are quite correct, there is a text file produced!
>     > Still,  I am not sure which rows belong to which animals/bursts.
>     Do you
>     > know of a way to carry this information from the ltraj object into the
>     > output of a fipati object?
>     > Since I coerced my original dataframe into a regular timeseries there
>     > will be several observations that the function  sett0 ()  filled in,
>     > correct? This is why I have more rows in the fpt () output then in my
>     > raw data.
>     > But Im not sure how to match the rows of the ltraj object with the
>     > output of fpt().
>     > In my mind, it would make sense to write.table () the ltraj
>     object, and
>     > match rows with the fpt() output.
>     > But when I tried I get:
>     >         ERROR:  arguments imply differing number of rows
>     >
>     >
>     > Thanks again,
>     >
>     >
>     > Adam
>     >
>     > On Mon, Jan 31, 2011 at 3:45 PM, Mathieu Basille
>     > <basille at ase-research.org <mailto:basille at ase-research.org>
>     <mailto:basille at ase-research.org <mailto:basille at ase-research.org>>>
>     wrote:
>     >
>     >     Dear Adam,
>     >
>     >     What's wrong with the output of write.table? I can do the
>     following
>     >     without any error (building upon the example of fpt):
>     >
>     >     data(puechcirc)
>     >     i <- fpt(puechcirc, seq(300,1000, length=30))
>     >     bla <- do.call(rbind, i)
>     >     write.table(bla, file = "bla.txt")
>     >
>     >     And the resulting text file is fine.
>     >
>     >     Mathieu.
>     >
>     >
>     >     Le 2011-01-31 17:37, Adam T. Ford a écrit :
>     >     > Hello Animovers,
>     >     >
>     >     > I am having trouble extracting the results of the fpt ()
>     function.
>     >     > As far as I can tell, this function is working correctly,
>     all the
>     >     plots
>     >     > appear in order etc.
>     >     >
>     >     > I have 7 animals with different sampling periods representing a
>     >     total of
>     >     > 48 'bursts'. So I have 48 dataframes assembled as a "fipati"
>     object.
>     >     > My problem is that I  am not sure how to compile a list of
>     multiple
>     >     > dataframes in way that I can analyze it statistically, or
>     look at it
>     >     > completely.
>     >     >
>     >     > I have tried (for example):
>     >     >
>     >     >    i <- fpt(puechcirc, seq(5, 100, 5), units = "hours")
>     >     >    do.call(rbind, i)
>     >     >
>     >     > and then I tried write.table() to export to a text file but
>     got a
>     >     series
>     >     > of errors, for example:
>     >     >
>     >     >     23] WARNING: Warning: \U used without hex digits
>     >     >     Warning: '\A' is an unrecognized escape in a character
>     string
>     >     >     Warning: '\D' is an unrecognized escape in a character
>     string
>     >     >     Warning: '\D' is an unrecognized escape in a character
>     string
>     >     >     Warning: '\S' is an unrecognized escape in a character
>     string
>     >     >    Warning: '\J' is an unrecognized escape in a character string
>     >     >
>     >     > Has anyone else worked had success extracting information from a
>     >     fipati
>     >     > class object?
>     >     >
>     >     > I realize this is porbably a simple "r-rookie" question, but
>     i cannot
>     >     > find what I am looking for in other forums, my r book etc
>     >     >
>     >     > Great work on this package by the way, very helpful and much
>     needed in
>     >     > the ecological community.
>     >     >
>     >     > Adam T. Ford
>     >     > Ph.D. Candidate
>     >     > Department of Zoology
>     >     > University of British Columbia
>     >     > Vancouver, B.C
>     >     >
>     >     > Canada
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > _______________________________________________
>     >     > AniMov mailing list
>     >     > AniMov at faunalia.it <mailto:AniMov at faunalia.it>
>     <mailto:AniMov at faunalia.it <mailto:AniMov at faunalia.it>>
>     >     > http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov
>     >
>     >     --
>     >
>     >     ~$ 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.
>     >
>     >
> 
>     --
> 
>     ~$ 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.
> 
> 

-- 

~$ 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 AniMov mailing list