As said in the help file:

criterion: a character string giving any syntactically correct R
          logical expression implying the descriptive parameters in ‘x’

Try to put your criterion within quotes, such as:

df <- cutltraj (depurelt, "dt > 3600", nextr = TRUE)

I tested it with the 'puechcirc' dataset:

library(adehabitatLT)
data(puechcirc)
pp <- na.omit(puechcirc)
pp2 <- cutltraj(pp, "dt > 1500")

Hope this helps,
Mathieu.


Le 16/02/2015 07:32, Jose Manuel de los Reyes a écrit :

Hi all,

I'm working with GPS dataset from seabirds that include more than one trip
for each burst, and currently I'm trying to split then automatically in
sub-burst based on a criterion.

To do that I'm trying to use the function cutltraj from AdehabitatLT R
package. Previously I removed all positions matching an specific condition,
so now, after applying the as.ltraj function, my dataframe has ltraj class
and I can use the dt field values as criterion to make the split.
This criterion is so simple: time between two position > 3600  (units in
seconds). This time is enough to determine when the burst need to be splited.

I applied it:

df <- cutltraj (depurelt, dt>3600, nextr = TRUE)

According to this, a logical vector (with TRUE when criterion does match)
should work for splitting.  If I check with the common datframe class, dt
field exists and it's correct, and the logical function dt>3600 run
correctly and I get a TRUE-FALSE vector.


However, when I run the function I got this error message:

Error in dt > 3600 :
   comparison (6) is possible only for atomic and list types


Since ltraj class is in fact a list object, I don't understand why I get
this error.

If someone have any idea why is this happening, please let me know.

Thank you in advance.

jose



_______________________________________________
AniMov mailing list
AniMov@faunalia.it
http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov


--

~$ whoami
Mathieu Basille
http://ase-research.org/basille

~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314

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

_______________________________________________
AniMov mailing list
AniMov@faunalia.it
http://lists.faunalia.it/cgi-bin/mailman/listinfo/animov

Reply via email to