[R] Problem with SAGx Library

Rohit Vishal Kumar rohitvk at vsnl.com
Wed Sep 21 17:30:12 CEST 2005

Dear All:

I am a  newbie to R and as such i am posting this request for help.

I am trying to use R to compute the "Calinski Harabasz (CH) Index ". The 
  CH Index is available in the library SAGx.

The version of R i am running is 2.2.1.

I have my data in a CSV format which i read into R using the
read.table() command.  After the data has been read i am loading in the
"SAGx" and "MASS" libraries.

According to the SAGx help files the command for running a CH
procedure is as follows:

caha(data, cluster)

where: "data" is the data matrix and "cluster" is a vector describing 
the cluster membership consecutive numbers.

The commands that i give are as follows:

| > cl <- myclus(mydata, k=3)
| > caha(mydata, cl$cluster)

I get the following output
Error in "[.data.frame"(x, , cl == (i + min(cl) - 1)) :
         undefined columns selected

I cannot make head or tail out of the error.

Strangely enough SAGx the procedure "gap" to calculate the GAP
statistic has the same format as CH. So when i give the command (shown
below) after several minutes of computation i get the value for the
statistic say 0.39765:

| > gap (mydata, cl$cluster)
[1] 0.39765

Am i doing something wrong when i am implementing caha?

As my knowledge of R is quite limited i shall be extremely grateful for
your help in this regard.

Thanking you once again.

Rohit Vishal Kumar

More information about the R-help mailing list