The R Project SVN R

Rev

Rev 61168 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61168 Rev 61186
Line 60... Line 60...
60
hci <- hclust(dist(iris[,1:4]))
60
hci <- hclust(dist(iris[,1:4]))
61
plot(hci)
61
plot(hci)
62
identify(hci, function(k) print(table(iris[k,5])))
62
identify(hci, function(k) print(table(iris[k,5])))
63
 
63
 
64
# open a new device (one for dendrogram, one for bars):
64
# open a new device (one for dendrogram, one for bars):
65
get(getOption("device"))() # << make that narrow (& small)
65
dev.new() # << make that narrow (& small)
66
                           # and *beside* 1st one
66
          # and *beside* 1st one
67
nD <- dev.cur()            # to be for the barplot
67
nD <- dev.cur()            # to be for the barplot
68
dev.set(dev.prev())  # old one for dendrogram
68
dev.set(dev.prev())  # old one for dendrogram
69
plot(hci)
69
plot(hci)
70
## select subtrees in dendrogram and "see" the species distribution:
70
## select subtrees in dendrogram and "see" the species distribution:
71
identify(hci, function(k) barplot(table(iris[k,5]), col = 2:4), DEV.FUN = nD)
71
identify(hci, function(k) barplot(table(iris[k,5]), col = 2:4), DEV.FUN = nD)