[R-sig-Geo] mcp calculation
Mathieu Basille
basille.web at ase-research.org
Thu Nov 28 00:22:56 CET 2013
Dear Lutfor,
It should work out of the box with the current version of adehabitatHR,
which does not rely on gpclib for MCP estimations. Here is an example using
R 3.0.2 and adehabitatHR 0.4.10:
## Load adehabitatHR
library(adehabitatHR)
## This give me:
#
# Loading required package: sp
# Loading required package: deldir
# deldir 0.1-1
# Loading required package: ade4
#
# Attaching package: ‘ade4’
#
# The following object is masked from ‘package:base’:
#
# within
#
# Loading required package: adehabitatMA
# Loading required package: adehabitatLT
# Loading required package: CircStats
# Loading required package: MASS
# Loading required package: boot
#
## As you can see, gpclib is not loaded.
## Load example data
data(puechabonsp)
rel <- puechabonsp$relocs
## Estimates the MCP
cp <- mcp(rel[,1])
## The home-range size
as.data.frame(cp)
# id area
# Brock Brock 22.64670
# Calou Calou 41.68815
# Chou Chou 71.93205
# Jean Jean 55.88415
## Computation of the home-range size:
mcp.area(rel[,1])
# Brock Calou Chou Jean
# 20 2.01000 8.06000 15.74195 1.13685
# 25 2.05565 9.96440 16.11330 1.48680
# 30 2.44080 13.27520 16.67075 1.69070
# 35 6.46570 13.65330 18.04590 2.33475
# 40 7.01845 14.88035 22.65340 4.09565
# ...
Hope this helps,
Mathieu.
Le 11/27/2013 05:31 PM, Lutfor a écrit :
> Dear forum members,
>
> Today, I upgraded my R with 3.0.2. I was going to use my old code for MCP
> calculation using adehabitat. But when I was going use mcp.area calculation
> it says, i do need gpclib. Unfortunately new version of R don't have gpclib
> packages. I was trying to do with adehabitatHR but now luck yet. could
> anyone help to calculated mcp.area from my data.
>
> I have used following code for my calculation.
>
> mcpdata1<-read.csv("DataMCPKernel.csv",header=T)
> attach(mcpdata1)
>
> XY=mcpdata1[,c("x","y")]
> id=mcpdata1[,c("Stage")]
>
> HrMcp<-mcp.area(XY,id)
> #When I do run above command following error message pop up.
> Loading required package: gpclib
> Failed with error: ‘‘gpclib’ is not a valid installed package’
> Error in mcp.area(XY, id) : package gpclib required
>
> I would greatly appreciate if you get me any suggestion (I tried to follow
> adehabitatHR example but sorry to say not having any luck with my data).
>
> My data:
>
> Stage x y
> incubation 646446.9 5213729
> incubation 646395.1 5213765
> incubation 646395.1 5213765
> incubation 646395.1 5213765
> incubation 646382.5 5213783
> incubation 646395.1 5213765
> incubation 646395.5 5213746
> incubation 646665 5213605
> incubation 645684.8 5213821
> incubation 646396 5213727
> incubation 648337.4 5214609
> incubation 643467.4 5214935
> incubation 646395.1 5213765
> incubation 642319.7 5214203
> incubation 646244.7 5214224
> incubation 643306.7 5214227
>
> Kind regards
> Lutfor
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/mcp-calculation-tp7585219.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
~$ whoami
Mathieu Basille, PhD
~$ locate --details
University of Florida \\
Fort Lauderdale Research and Education Center
(+1) 954-577-6314
http://ase-research.org/basille
~$ fortune
« Le tout est de tout dire, et je manque de mots
Et je manque de temps, et je manque d'audace. »
-- Paul Éluard
More information about the R-sig-Geo
mailing list