# Create data
set.seed(1)
m <- matrix(rep(1,3*24),ncol=3)
m[9:16,3] <- 3 ; m[17:24,] <- 3 #create 3 groups
m <- m+rnorm(24*3,0,0.5) #add noise
m <- floor(10*m)/10 #just one digits
# use library stats
# Cluster columns
hc <- hclust(dist(t(m)))
# Cluster rows
hr <- hclust(dist(m))
# Export files
r2atr(hc,file="cluster.atr")
r2gtr(hr,file="cluster.gtr")
r2cdt(hr,hc,m ,file="cluster.cdt")
Run the code above in your browser using DataLab