Hi Milton,
all.id produces all 5000+ points of the 32 animals
H
From:
animov-bounces-h12OV65+u/41GQ1Ptb7lUw@public.gmane.org [mailto:animov-bounces-h12OV65+u/41GQ1Ptb7lUw@public.gmane.org] On Behalf Of Milton
Cezar Ribeiro
Sent: Thursday, June 03, 2010 10:35 AM
To: 'Animal Movement'
Subject: [AniMov] RES: Adehabitat: creating MCPs every two weeks for 32
different animals
Hi Abdi,
How many points you get per id
with table(all.id)?
Cheers
milton
De: animov-bounces-h12OV65+u/41GQ1Ptb7lUw@public.gmane.org
[mailto:animov-bounces-h12OV65+u/41GQ1Ptb7lUw@public.gmane.org] Em nome de Abdi, Abdulhakim
Enviada em: Thursday, June 03, 2010 11:19 AM
Para: AniMov-h12OV65+u/41GQ1Ptb7lUw@public.gmane.org
Assunto: [AniMov] Adehabitat: creating MCPs every two weeks for 32
different animals
Dear List,
I’m trying to detect patterns in the movements of a nomadic
gazelle species during the breeding season. Basically, I would like to create
MCPs (minimum convex polygons representing home ranges) for each of the 32
gazelles every two weeks starting on September 4th 2007. I have
satellite tracking points from September 2007 to January 2010. The point of
this exercise is to see whether the animals converge at particular areas during
the breeding season or whether the site selection is random.
Before going into the date loop procedure I attempted to
create MCPs for the animals without regard for the two-week interval:
Here is what my data.frame looks like:
> head(all.frame)
Name Status
X Y
Date
1 76792
capture 1356206 2196167 2007-09-04
2 76795
capture 1354434 2209845 2007-09-04
3 76797
capture 1354434 2209845 2007-09-04
And here is the output of the command, as you can see I get
an error statement:
> all.xy =
all.frame[,c("X","Y")]
> all.id =
all.frame$Name
> all.mcp =
mcp(all.xy, all.id, percent=95)
Error in mcp(all.xy,
all.id, percent = 95) :
At least 5
relocations are required to fit an home range
Next, I ran MCPs for the “puechabon$loc” data.frame that
comes with Adehabitat and it worked without producing any errors, so I compared
my data.frame with puechabon$loc.
>
head(puechabon$loc)
Name
Age Sex X
Y Date
1 Brock
2 1 699889 3161559 930701
2 Brock
2 1 700046 3161541 930703
3 Brock
2 1 698840 3161033 930706
Looking at the structure of both, my dataset has the date
set to class ‘Date’ while in the Puechabon dataset it’s set to ‘Integer’ and
the dates are concatenated as “yymmdd”:
> str(all.frame)
'data.frame':
5059 obs. of 5 variables:
$ Name :
Factor w/ 32 levels "76790","76792",..: 2 5 7 7 1 3 5 8 7 7
...
$ Status:
Factor w/ 3 levels "argos","capture",..: 2 2 2 3 2 2 1 2 3
3 ...
$
X : int 1356206 1354434 1354434 1349773 1362802
1362802 1357468 1362802 1345648 1345387 ...
$
Y : int 2196167 2209845 2209845 2211725 2216920
2216920 2176051 2216920 2213362 2213572 ...
$ Date
:Class 'Date' num [1:5059] 13760 13760 13760 13761 13761 ...
>
str(puechabon$loc)
'data.frame':
119 obs. of 6 variables:
$ Name: Factor
w/ 4 levels "Brock","Calou",..: 1 1 1 1 1 1 1 1 1 1 ...
$ Age :
int 2 2 2 2 2 2 2 2 2 2 ...
$ Sex :
int 1 1 1 1 1 1 1 1 1 1 ...
$
X : int 699889 700046 698840 699809 698627 698719 698991
698626 698879 699756 ...
$
Y : int 3161559 3161541 3161033 3161496 3160941 3160989
3161015 3160768 3160964 3161449 ...
$ Date:
int 930701 930703 930706 930707 930708 930709 930713 930714 930715 930720
...
I tried to convert my dates to the “yymmdd” format, without
any luck as the new column came out exactly the same as the original one:
> all.frame$Date2
= as.Date(all.frame$Date, format="%y/%m%/d")
> head(all.frame)
Name Status
X Y
Date Date2
1 76792
capture 1356206 2196167 2007-09-04 2007-09-04
2 76795
capture 1354434 2209845 2007-09-04 2007-09-04
3 76797
capture 1354434 2209845 2007-09-04 2007-09-04
So, I have three questions: is it only a date format issue
or am I missing something else? If it is a date format issue, then, how would
it be possible to convert my dates in “YYyy-mm-dd” into “yymmdd”? and finally
what loop functions or steps could I take to create MCPs for the animals every
two weeks.
Any help is greatly appreciated.
Regards,
Hakim Abdi
_________________________________
Abdulhakim Abdi, M.Sc.
Research Intern
Conservation GIS/Remote Sensing Lab
Smithsonian Conservation Biology Institute
1500 Remount Road
Front Royal, VA
phone: +1-540-635-6578
fax: +1-540-635-6506
email: abdia-1Qnjj5vVSdU@public.gmane.org