[R] subscript out of bounds error in lda

From: Silvia Lomascolo <slomascolo_at_zoo.ufl.edu>
Date: Fri, 15 Jun 2007 08:47:59 -0700 (PDT)

I work with Windows, R version 2.4.1

I'm trying to do a discriminant analysis and, in trying to figure out how to do it following the example from R help, I'm getting an error that says 'subscript out of bounds'. I don't know what this means and how to solve it (I'm very new with R)

I'm doing everything in this made-up test matrix:

   group var1 var2 var3

1      1    3   55    6
2      1    4   66    7
3      1    5   55    8
4      1    4   66    7
5      1    3   44    6
6      1    4   55    5
7      2    5   88    9
8      2    4   99    8
9      2    8   88    9
10     2    9   76    8
11     2    8   66    9
12     2    9   99   10
13     2   10  100    9

I write:

data.tb<-read.table('locationHere.txt', header=T)

data.df<-as.data.frame (data.tb)                                                           
train<-sample (1:63, 30)                                                                                                                                                       
table (data.df$group[train])                                                                 
data.disc<-lda(group~., data.tb, subset = train)                                             
data.disc                                                                                    
predict (data.disc, data.df[-train,])$class              

This is where I get the message:

Error in `[.data.frame`(data.df, -train, ) :

        subscript out of bounds

Can anyone, please help me figure out what this is about? Thanks!

Silvia.

-- 
View this message in context: http://www.nabble.com/subscript-out-of-bounds-error-in-lda-tf3928773.html#a11142304
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_stat.math.ethz.ch 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.
Received on Fri 15 Jun 2007 - 16:43:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 15 Jun 2007 - 18:32:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.