[R] SPACECAP error "subscript out of bounds"
jim holtman
jholtman at gmail.com
Sat Oct 27 22:54:14 CEST 2012
Now is the time to learn how to debug your scripts. First order of
business is to add:
options(error = utils::recover)
to your script. Then type in:
?recover
?browser
and carefully read the documentation. Then when the error occurs, you
will be in the "browser" and can examine that values of the objects
and find out which one is causing the "subscript out of bounds". Look
at the dimensions of the objects that you are using and the values of
the objects that are defining the indices. Then you will know where
your problem is.
On Fri, Oct 26, 2012 at 4:34 PM, jmosley <asia7 at vt.edu> wrote:
> CENTERS.csv <http://r.789695.n4.nabble.com/file/n4647606/CENTERS.csv> Hello
> all,
>
> I'm trying to run SPACECAP. A couple of days ago I ran it with a centers
> file with 300 GPS points, now I'm trying to run it with 2250, but I get this
> error:
>
> Error in NN[i, 1:length(od)] <- od : subscript out of bounds
>
> I tried running SPACECAP with 1000 and 2000 points, but it still is not
> working. I've updated R, I reinstalled and then reloaded SPACECAP, checked
> the excel spreadsheets, I've looked everywhere for some answer, but I've
> found nothing but an old thread dated 2011.
> (http://r.789695.n4.nabble.com/Error-message-for-csv-file-td3807651.html)
>
> I've attached my file with the 2250 GPS points, points were created in GME
> with the random points generator tool. As for the file, I'll try and answer
> some of the questions that the people posed to the user in 2011:
>
> str(NN)--str(centers) = > str(centers)
> 'data.frame': 2250 obs. of 3 variables:
> $ X_COORD: num 353744 349686 350758 351545 351545 ...
> $ Y_COORD: num 8318707 8319311 8317761 8318474 8319172 ...
> $ HABITAT: int 1 1 1 1 1 1 1 1 1 1 ...
>
> dim(NN) --dim(centers)
>> dim(centers)
> [1] 2250 3
>
> length(od) --length(centers) [not entirely sure if I'm supposed to be
> finding this length or the length of something else]
>> length(centers)
> [1] 3
>
> and where it comes from--my computer. It's a CSV file, points from GME
> random point generator. Nothing special.
>
> And, additionally, if I try to run the commands as given in the forum
> (dim(NN)), I get NN is not found/od is not found.
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/re-SPACECAP-error-subscript-out-of-bounds-tp4647606.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
--
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
More information about the R-help
mailing list