[R-sig-Geo] small bug in adehabitatHR function BRB
Clement Calenge
clement.calenge at oncfs.gouv.fr
Sat Dec 15 12:36:32 CET 2012
It's not a bug, it's a feature! The function BRB uses internally the
function match.arg, that checks that the argument type passed by the
user is one of the the three possible values (Also, partial matching is
allowed, so that type="U" is considered identical to type = "UD"). If a
vector is passed, then the first element is considered to be the value
of the argument. Therefore, by default, BRB calculates the "UD".
Argument matching is described in the R language definition:
http://cran.r-project.org/doc/manuals/R-lang.html#Argument-matching
and for the function match.arg, see the help page of this function:
?match.arg
Best Regards,
Clément Calenge
On 12/15/2012 08:24 AM, camposfa wrote:
> The function BRB of the package adehabitatHR implements the biased random
> bridge method of home range estimation. It takes the following argument by
> default:
>
> type=c("UD","ID", "RD")
>
> This suggests that the function will return three types of distributions
> (utilization distribution, intensity distribution, and recursion
> distribution). However, only the utilization distribution is returned by
> default. From browsing the code, the function does not appear to be designed
> to return more than one type of distribution (although this would be very
> useful). Thus, the default value of the argument should probably be:
>
> type="UD"
>
> It is not clear to me why this small bug does not produce an error. For
> example, an error is produced if you attempt to call the function with
> type=c("UD","ID")
>
> #####
> # Using the example data set from the package documentation
> data(buffalo)
> vv <- BRB.D(buffalo$traj, Tmax = 180*60, Lmin = 50,habitat =
> buffalo$habitat, activ = "act")
> ud <- BRB(buffalo$traj, D = vv, Tmax = 180*60, tau = 300, Lmin = 50,
> hmin=100, habitat = buffalo$habitat, activity = "act", grid = 50, b=0,
> type=c("UD","ID"), same4all=FALSE, extent=0.5)
> #####
>
> Generates the following error:
> Error in match.arg(type) : 'arg' must be of length 1
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/small-bug-in-adehabitatHR-function-BRB-tp7581950.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
>
--
Clément CALENGE
Cellule d'appui à l'analyse de données
Direction des Etudes et de la Recherche
Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33) 01.30.46.54.14
More information about the R-sig-Geo
mailing list