R language Access Menu

Title Text Both  


Classification in the form of dendrograms can be done with following commands (only first 10 rows of dataset are used here to simplify the plot):


    > fit = hclust(dist(bwdf[1:10,]))
    > plot(fit)

Output graph:


It shows that rows named '0-1' an '0-2' are very similar to each other. 

Following command which uses varclus (variable clustering) function of Hmisc package can be used to create dendrogram of different variables: 


    > library(MASS)
    > data(birthwt)
    > library(Hmisc)    
    > plot(varclus(as.matrix(birthwt)))

Output graph:



It can be seen that low and bwt are related, as are age and ftv and also race and smoke. 

mass package: Venables, W. N. & Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth Edition. Springer, New York. ISBN 0-387-95457-0 

Frank E Harrell Jr, with contributions from Charles Dupont and many others. (2015). Hmisc: Harrell Miscellaneous. R package version 3.16-0. http://CRAN.R-project.org/package=Hmisc

    Comments & Feedback