[R] hclust title and paste - messed up

Dan Bolser dmb at mrc-dunn.cam.ac.uk
Mon Oct 11 13:40:44 CEST 2004


I use the following code to scan a (limited) parameter space of clustering
strategies ...

data <- read.table(... 

dataTranspose <- t(data)

distMeth <- c("euclidean",
              "maximum",
              "manhattan",
              "canberra",
              "binary"
              )

clustMeth <- c("ward",
             "single",
             "complete",
             "average",
             "mcquitty",
             "median",
             "centroid"
             )

par(ask=TRUE)

for (d in distMeth){
  print(d)
  dt <- dist(dataTranspose,method=d)
  for (m in clustMeth){
    print(m)
    hc <- hclust(dt,method=m)
    plot(hc,
         main=paste(c(
           "Distance Measure", d,
           "Cluster Method", m),sep=" "),
         xlab='',
         sub=''
         )
  }
}


However, my plot title (main) has 4 lines, when I think it should only
have one line.

What am I doing wrong?




More information about the R-help mailing list