Hi Eliza, this is not __reproducible__ code - how am I supposed to know what's wrong when I don't have the input files you use? Please read the help for NbClust carefully and check that all your input variables have the correct dimensions. Some of the input seems strange, for example the z matrix that contains column sums of x, and you say diss = "z" instead of dist = z, which would make more sense. But like I said, I am not familiar with NClust, so maybe I'm wrong.
Peter On Tue, Oct 9, 2012 at 4:53 PM, eliza botto <eliza_bo...@hotmail.com> wrote: > Thankyou very much peter, > here is the code > > filelist = list.files(pattern = ".*.txt") > > datalist = lapply(filelist, function(x)read.table(x, header=T)) > > datafr = do.call("cbind", datalist) > > x<-datafr > > colnames(x) <- c("1": "38") > > m=matrix(x, nrow=365) > > mat1<-m > > list1<-list() > > for(i in 1:ncol(mat1)){ > > list1[[i]]<-t(apply(mat1,1,function(x) x[i]-x)) > > list1} > > x<-list1 > > x<-matrix(unlist(x),ncol=1444) > > x<-abs(x) > > y<-colSums(x, na.rm=FALSE) > > z<-matrix(y, ncol=38) > > > NbClust(m, diss="z", distance = "NULL", min.nc=2, max.nc=15, method = > "ward", index = "all", alphaBeale = 0.1) > > > thanks once again > > eliza > > > >> Date: Tue, 9 Oct 2012 16:47:18 -0700 >> Subject: Re: [R] Error in if (is.na(n) || n > 65536L) stop("size cannot be >> NA nor exceed 65536") : missing value where TRUE/FALSE needed >> From: peter.langfel...@gmail.com >> To: eliza_bo...@hotmail.com >> CC: r-help@r-project.org >> >> On Tue, Oct 9, 2012 at 4:37 PM, eliza botto <eliza_bo...@hotmail.com> >> wrote: >> > >> > Dear useRs, >> > >> > i am using NbClust to determine appropriate number of cluster for >> > hclustering. i am consistently getting the following error >> > >> > Error in if (is.na(n) || n > 65536L) stop("size cannot be NA nor exceed >> > 65536") : >> > missing value where TRUE/FALSE needed >> >> It looks like your variable 'n' is NULL. I am not familiar with >> NbClust but if I had to guess, my guess would be that it expects a >> matrix with 2 dimensions (one of which is 'n'), and you are giving it >> an argument whose 'dim' is NULL (perhaps you think you have a >> data.frame but it is in fact a list? Or instead of a matrix you give a >> vector (or distance)?) >> >> If you give us more information (and reproducible code!), we can help you >> more. >> >> HTH >> >> Peter ______________________________________________ R-help@r-project.org 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.