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. 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? Thanks, J [[alternative HTML version deleted]]
> 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. > 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?You could start by giving us enough information to help you. What package did you get the domain() function from? What do your data look like? str() and dim() are both useful for describing data. Can you provide a minimal workable example? dput() is one option for providing data. All we can tell you right now is that your data are in some way the wrong size or shape. Sarah -- Sarah Goslee http://www.functionaldiversity.org
David Winsemius
2011-Mar-24 20:50 UTC
[R] Questions for "domist... subscript out of bounds"
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