[R] Questions for "domist... subscript out of bounds"

David Winsemius dwinsemius at comcast.net
Thu Mar 24 21:50:31 CET 2011


On Mar 24, 2011, at 1:15 PM, jessiecy2001 wrote:

> Hi all,
>
> I am a new user for R.
>
> I faced a questions about subscript out of bounds.
> Although I checked some other helps before I sent this email, I  
> still don't know
> how to deal with this problems.
>
> I want to use "domain" function to run species distribution model in  
> R.
> I used "sp.occ.do<-domain(env.pre, pred_train,  
> factors=c('continent')) &
> sp.occ.pre.pro<-predict(env.pre, sp.occ.do)" to predict species  
> distribution.

That seems  an odd way to use predict(). Generally the first argument  
to predict is a fit object. I'm assuming that `domain` returns some  
sort of model. Is that true? And where did `env.pre` come from? Also  
you should copy code directly, and not throw in extra quotes and  
ampersands since they are valid R operators.

> BUT, I got  "Error in domdist(object, ln[j], vals[, ln[j]]) :  
> subscript out of
> bounds" and could not run the domain model.
>
> How can I solve this problem?

Well, you could offer the package from which these functions are being  
used. The `domain` function is NOT part of base R:

 > ?domain
No documentation for 'domain' in specified packages and libraries:
you could try '??domain'

And you should offer a test dataset or point to where one might be  
found.


-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list