r - parcoord, only one line accross all groups -


i have data frame, both vectors have same elements in different orders:

df <- data.frame(g1=c("b","a","e","d","c"), g2=c("c","d","e","b","a")) 

and compare them, using g1 reference. terms re-ordered accordingly in g2

df$g1.num <- 1:length(df$g1) df$g2.num <-  match(df$g2,df$g1) 

when plot parcoord, see how positions of elements in g1 change when in g2

  df <- subset(df,select = c(g1.num, g2.num))     parcoord(df, col = rainbow(nrow(df))) 

since have large data set, many elements, plot looks confusing. therefore. 1 plot per elements. for example: element "b" only, changing position 1 position 4.

you can

apply(df, 1, plot, type="l") 

this loop through rows, , plot. if you're in interactive session, they'll loop through quite quickly. if surround apply file(pdf="lines.pdf") , dev.off() you'll capture lines on different pages.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -