[R] problem with mahal function Package dismo

David Carlson dcarlson at tamu.edu
Tue Aug 6 19:39:36 CEST 2013


It appears that you are trying to pass a data.frame to the function
and it is complaining. You didn't give us enough information to know
for sure (e.g. str(predictor) and str(Cfin)), but you could try

mm<-mahal (as.matrix(predictor), as.matrix(Cfin))

-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Ernesto Villarino
Sent: Tuesday, August 6, 2013 5:51 AM
To: r-help at r-project.org
Subject: Re: [R] problem with mahal function Package dismo

Hi all,
I want to apply mahal function using data.frame instead of raster
data
but I am having problems (see error message below). I want to use
data.frame since we have seasonal data (the species distribute
differently as a function of months).

> head (predictor)

       OCPT     x1XM     z        Pc     pHxM      MLD
38 21.23519 36.24476 -3164  8.836913 8.082310 68.09159
39 21.13811 36.25013 -2487  8.451318 8.077561 57.78384
40 21.03920 36.25259 -2025  8.132195 8.073292 62.59614
41 20.94312 36.25257 -3409  7.851401 8.069450 55.83329
79 21.22135 36.10911   -40 18.707443 8.108031 42.55479
80 21.14884 36.13638 -2800 21.133693 8.063561 64.28003

> head (Cfin)

   Lat Long
38  35  -38
39  35  -37
40  35  -36
41  35  -35
79  36  -75
80  36  -74

> mm<-mahal (predictor,Cfin)
Error en (function (classes, fdef, mtable)  :
  unable to find an inherited method for function 'mahal' for
signature
'"data.frame", "data.frame"'

Can you help me ??
Thanks,
Regards,
Ernesto

	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list