Thanks so much for your help, Clément, your suggestion helped solve one of my 
questions, it identified the animal that had less than 3 relocations (98391), 
but it gave me an error when trying to implement the MCP:

> any(table(all.id)<5)
[1] TRUE
> ta <- table(all.id)<5
> ta[ta<5]
all.id
76790 76792 76793 76794 76795 76796 76797 76798 87942 87943 87944 87945 87946 
87947
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
FALSE
87948 87949 87950 87951 87952 87953 87954 87955 87956 98382 98383 98384 98385 
98386
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 
FALSE
98387 98388 98389 98391
FALSE FALSE FALSE  TRUE
> out <- names(ta[ta<5])
> pc <- mcp(all.xy[!(all.id%in%out),], factor(all.id[!(all.id%in%out)]))
Error in apply(df.t, 1, dist.cdg) : dim(X) must have a positive length
In addition: Warning message:
In min(table(id)) : no non-missing arguments to min; returning Inf

I fixed the issue by removing all the rows from the data.frame that contained 
that particular animal using:

gaz.sub = subset(all.frame, Name != 98391)

And then tried the MCP with success.

Also, I solved the two-week issue by creating a variable for each two-week 
interval to include in the analysis:

start.date = '2007-09-04'
end.date = '2010-01-09'
two.weeks = seq(from = as.Date(start.date)  , to =  as.Date(end.date), by = 14)

I apologize for the duplicate posting in the AniMov listserv, I didn't know the 
same subscribers were on lists hosted on different servers.

All the best,

Hakim



_________________________________
Abdulhakim Abdi, M.Sc.
Research Intern

Conservation GIS/Remote Sensing Lab
Smithsonian Conservation Biology Institute
phone: +1-540-635-6578
fax: +1-540-635-6506
email: [email protected]



From: Clément Calenge [mailto:[email protected]]
Sent: Friday, June 04, 2010 4:50 AM
To: Abdi, Abdulhakim
Cc: [email protected]
Subject: Re: [R-sig-eco] Adehabitat: creating MCPs every two weeks for 32 
different animals

Several answers to your question are already available here:
http://lists.faunalia.it/pipermail/animov/2010-June/000601.html
http://lists.faunalia.it/pipermail/animov/2010-June/000602.html
Please avoid cross-posting,
Best,

Clément Calenge


On 06/03/2010 04:18 PM, Abdi, Abdulhakim wrote:

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: 
[email protected]<mailto:[email protected]><mailto:[email protected]><mailto:[email protected]>



        [[alternative HTML version deleted]]



_______________________________________________

R-sig-ecology mailing list

[email protected]<mailto:[email protected]>

https://stat.ethz.ch/mailman/listinfo/r-sig-ecology








--

Clément CALENGE

Cellule d'appui à l'analyse de données

Office national de la chasse et de la faune sauvage

Saint Benoist - 78610 Auffargis

tel. (33) 01.30.46.54.14

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Reply via email to