Analysis of Iris Dataset in R Programming

Analysis of Iris Dataset in R Programming

2018, Dec 26    

First of all you need to install ‘multigraph’ library if already not installed

  • load ‘multigraph’ library
library(multigraph)
  • Load Iris dataset as matrix in matrix variable
matrix <- data.matrix(iris)
  • Matrix transpose because ‘cor’ method calculate column wise correlation
trn <- t(matrix)
  • Calculate pairwise correlation (150*150) in pwcor variable
pwcor <- cor(trn)
  • Save calculated (150*150) correlation in csv file
write.csv(pwcor, file = "correlation.csv")
  • Define scope of node / edge / graph characteristics as list object
scp3 <- list(cex = 1, fsize = 3, pch = c(19, 15), lwd = 1.5, vcol = 2:3)
  • Map pairwise correlation (150*150) to ‘circ2’ layout base graph
bmgraph(pwcor, layout = "circ2", scope = scp3, main = "Iris correlation using bmgraph")

Analysis of Iris Dataset in R Programming

  • Calculate mean, median and summary
mean(pwcor)
median(pwcor)
summary(pwcor)

DONE :)

Feel free to extend this post and don’t forget to share with others … :)