R language Access Menu

PARALLEL COORDINATE PLOT

Uses parcoord function of package MASS. The commands have been combined in a function for easy use:

Code:

> myparcoord = function(mydf, grpnum){
        library(MASS)
        parcoord(rn2numericdf(mydf), col=mydf[,grpnum], var.label=T, main=paste('Grouping by',names(mydf)[grpnum]))
        legend('topright',col=unique(mydf[,grpnum]),legend=unique(mydf[,grpnum]), lty=1, lwd=2)
}

> birthwt$low = 1+birthwt$low # 0 value produces no color on plot 
> myparcoord(birthwt, 1)      # column number 1 is the grouping variable

                    

It can be seen that 'low' of 2 is associated with lower age and lwt, and of course, higher bwt (birth weight variable from which 'low' variable is derived).


    Comments & Feedback