[R] would you give me hints in r?

Sarah Goslee sarah.goslee at gmail.com
Wed Sep 4 16:20:39 CEST 2013


Rui's suggestion and your reproducible example work for me. Can you
give us more information about what you did, including the output of
sessionInfo() ?

library(dismo)
ex<-structure(list(env1 = c(182, 163.33, 443.02, 1240.16), env2 = c(1134,
550, 2111, 2523), env3 = c(24.53, 24.93, 24.71, 21.05), env4 = c(0.05,
0, 0, 0)), .Names = c("env1", "env2", "env3", "env4"), row.names = c(NA,
-4L), class = "data.frame")

mod<-bioclim(ex)
pred<-predict(mod, ex)


On Wed, Sep 4, 2013 at 10:02 AM, Kristi Glover
<kristi.glover at hotmail.com> wrote:
> Hi Rui,
> Thanks for the message. i used dismo package.
> I changed the argument as you suggested, still did not work.
>
> Error in UseMethod("predict") :
>   no applicable method for 'predict' applied to an object of class "data.frame"
>
> Thanks
> KG
>
>> Date: Wed, 4 Sep 2013 14:57:45 +0100
>> From: ruipbarradas at sapo.pt
>> To: kristi.glover at hotmail.com
>> CC: r-help at r-project.org
>> Subject: Re: [R] would you give me hints in r?
>>
>> Hello,
>>
>> Where does the function bioclim come from? What package? If it's from
>> package dismo, then you should try predict() with the arguments reversed:
>>
>> pred <- predict(mod, ex)
>>
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>> Em 04-09-2013 13:48, Kristi Glover escreveu:
>> > Dear R User,
>> > Would you give me some hints on why I could not predict using data. format' data.
>> > Here is the example:
>> >
>> > ex<-structure(list(env1 = c(182, 163.33, 443.02, 1240.16), env2 = c(1134,
>> > 550, 2111, 2523), env3 = c(24.53, 24.93, 24.71, 21.05), env4 = c(0.05,
>> > 0, 0, 0)), .Names = c("env1", "env2", "env3", "env4"), row.names = c(NA,
>> > -4L), class = "data.frame")
>> >
>> > mod<-bioclim(ex)
>> > pred<-predict(ex,mod)
>> >
>> > Error in UseMethod("predict") :
>> >    no applicable method for 'predict' applied to an object of class "data.frame"
>> >
>> > Thanks for your help
>> > KG
>> >
>> >

Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list