[R] Getting runtime error in stepclass

From: Soma Saha <ssaha_at_ncsu.edu>
Date: Tue 05 Jul 2005 - 17:55:26 EST


Hi!

I got the following runtime error when I tried to use svm method with stepclass.

Error in "colnames<-"(`*tmp*`, value = c("0", "1")) :

        attempt to set colnames on object with less than two dimensions

I repeated the same sequence of statements but this time I used the classification function used in the example, i.e., "lda" and it worked fine but I got the same error when I tried randomForest.

As the same script worked with a different classification function, I am wondering if stepclass works with svm and randomForest.

I using R version 2.0.1 on a Linux machine. I am including the R script I used below.

I would be grateful for any suggestion on how to make stepclass work with these classification functions.

I would also like to make stepclass work with knn but knn does not have a 'predict' method, which is a requirement for a classification method to work with stepclass. Is there any way to get around this?

Thanks,
Soma

library("e1071")
library("randomForest")
library("klaR")

td <- read.table("dgdata1.txt", header=TRUE, sep=",") dgenes <- subset(td, dg == 1, select = dg:eg) ndgenes <- subset(td, dg == 0, select = dg:eg) n1 <- nrow(dgenes)
n2 <- nrow(ndgenes)
ndgrows <- 1:n2
selrows <- sample(ndgrows)
sndgenes <- ndgenes[selrows[1:n1],]

train <- rbind(dgenes, sndgenes)
attach(train)

traind <- subset(train, select = -dg)
trainr <- factor(dg)
detach(train)

sc_res <- stepclass(traind, trainr, "svm", direction = "forward", criterion = "AC", fold = 10)



R-help@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 Received on Tue Jul 05 18:09:56 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:12 EST