[R] Error message for .csv file

Sarah Goslee sarah.goslee at gmail.com
Mon Sep 12 18:59:26 CEST 2011


Go to your R session.

First off, tell the R-help list how you got your csv file into R as NN.
read.csv() ? read.table()?

Then tell us exactly what code you're using. Where did i come from?

Also type in exactly the commands I gave you (four lines), and share the
output with the R-help list.

str(NN)
dim(NN)
length(od)
i

The likely problems: either you imported the csv file incorrectly, or
there's something wrong with the code (a loop?) in which it is
processed. Without
the R commands you used for either, there's no way to tell which, or what.

Sarah

On Mon, Sep 12, 2011 at 12:49 PM, Vivien Kent <vivien.kent at gmail.com> wrote:
> Hi,
>
> I don't really understand what all that means I'm afraid. I am attaching the
> csv file which is just a list of coordinates classified as either habitat or
> non habitat. The other data I enter into the package are locations of
> captures (of animals) and locations of camera traps. I have got it to run in
> other scenarios with more rows so don't see what the problem can be.
>
> Thanks
>
> Vivien
>
> On 12/09/2011 17:43, Sarah Goslee wrote:
>
> Hi,
>
> On Mon, Sep 12, 2011 at 11:07 AM, vkent <vivien.kent at gmail.com> wrote:
>
> I would be grateful if anyone could tell me what the error message:
>
> Error in NN[i, 1:length(od)] <- od : subscript out of bounds
>
> It means that either i ends up being larger than the number of rows in
> NN, or that length(od) ends up being larger than the number of
> columns.
>
> More than that we can't tell you without more information, like, say,
> a reproducible example, or at least some information like
> str(NN)
> dim(NN)
> length(od)
> and where i comes from.
>
> How you got the csv file into R might also be relevant, or not.
>
> means for a large .csv file containing gps coordinates. I am using package
> SPACECAP and have successfully run it with other .csv files but now keep
> getting this error message. I can't see anything wrong with the file which
> is simply three columns of data.
>
> I am relatively new to R and am at a loss as to what I can do to correct
> this.
>
> Can anyone help?
>
> Thanks
>
> Vivien
>
>



-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list