You are on page 1of 1

Session 5- Data Visualization

Import the file- MBAdata.csv, give it a name mbaper

Mosaic plot or treemap

library(vcd)

mosaic(~mbaper$Marital_status)

mosaic(~Marital_status,mbaper)

mosaicplot(~mbaper$Marital_status)

mosaicplot(~Marital_status,mbaper)

# addmore variables

mosaic(~mbaper$Gender+mbaper$Marital_status+mbaper$Place_you_belong_to)

mosaicplot(~mbaper$Gender+mbaper$Marital_status+mbaper$Place_you_belong_to)

# cross tab mosaic

mosaic(mbaper$Gender~mbaper$Marital_status)

mosaicplot(mbaper$Gender~mbaper$Marital_status)

# cross tab mosaic more variables

mosaic(mbaper$Gender~mbaper$Marital_status+mbaper$perceivedscorecat)

# Better to use treemap

library(treemap)

treemap(mbaper, index = "Gender", vSize = "Percentage_in_10_Class")

# add variables

treemap(mbaper, index = c("Gender","STATE"), vSize = "Percentage_in_10_Class")

treemap(mbaper, index = c("STATE", "Gender"), vSize = "Percentage_in_10_Class")

http://learnrmanoharkapse.blogspot.com

You might also like