[R] Clustering and functions
Bryan Richardson
richarbb at email.uc.edu
Sat Nov 8 16:31:43 CET 2008
I am new to R and have written a function that clusters on subsets of a big data data set with 60,000 points. I am not sure why, but I keep getting a run-time error. Any suggestions would be greatly appreciated.
Here is the code:
library(cba)
d<-read.csv("data.csv", header=TRUE)
v<-c(53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,21,72 73,74,75,76,77,78)
clusterMe<-function(d,v){
tempMat<-subset(d,d[,v[1]]=="TRUE")
rc<-rockCluster(tempMat,n=5,theta=.2)
tempMat<-cbind(tempMat,rc$cl)
M<-tempMat
for (i in 2:26){
tempMat<-subset(d,d[,v[i]]=="TRUE")
rc<-rockCluster(tempMat,n=5,theta=.2)
tempMat<-cbind(tempMat,rc$cl)
M<-rbind(M,tempMat)
}
M
}
clusters<-clusterMe(d,v)
Bryan
More information about the R-help
mailing list