hi, all, i had a problem when i used kmeans as follow: > pp <- scan("m0028.data", quiet= TRUE) > x <- matrix(pp, nc=3, byrow=TRUE) > cl<-kmeans(x, 4, 20) > plot(x, col=cl$cluster) > save(cl$cluster, file="m0028.ks", ascii=TRUE) Error in save(cl$cluster, file = "m0028.ks", ascii = TRUE) : Object "cl$cluster" not found when i wanted to save the vector of cluster only, a reflection was thrown out as that. could i save cl$cluster only? how? thank you in advance. best, xp sun
XP Sun wrote:> hi, all, > > i had a problem when i used kmeans as follow: > > > pp <- scan("m0028.data", quiet= TRUE) > > x <- matrix(pp, nc=3, byrow=TRUE) > > cl<-kmeans(x, 4, 20) > > plot(x, col=cl$cluster) > > save(cl$cluster, file="m0028.ks", ascii=TRUE) > Error in save(cl$cluster, file = "m0028.ks", ascii = TRUE) : > Object "cl$cluster" not found > > when i wanted to save the vector of cluster only, a reflection was thrown out as that. > > could i save cl$cluster only? how? > thank you in advance.clc <- cl$cluster save(clc, .....) Uwe Ligges> best, > xp sun > > ______________________________________________ > 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
On Mon, 7 Mar 2005, XP Sun wrote:> hi, all, > > i had a problem when i used kmeans as follow:No, when you used save()!> > pp <- scan("m0028.data", quiet= TRUE) > > x <- matrix(pp, nc=3, byrow=TRUE) > > cl<-kmeans(x, 4, 20) > > plot(x, col=cl$cluster) > > save(cl$cluster, file="m0028.ks", ascii=TRUE) > Error in save(cl$cluster, file = "m0028.ks", ascii = TRUE) : > Object "cl$cluster" not found > > when i wanted to save the vector of cluster only, a reflection > was thrown out as that. > > could i save cl$cluster only? how? > thank you in advance.You can only save() named objects, not a single element, as its help page says. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595