About Me

Data Visualization can be used in these fields

Data Visualization CANNOT be used in these fields

Why visualize data ?

120,110,170,180,176,171,101 cms. - Your job is to select t-shirt sizes for them. - How many small t-shirts and how many large t-shirts ? - What else can we infer about this family ?

Why visualize data ?

library(tidyverse)
height_data <- data_frame(name = c("Anil","Bobby","Manju","Rekha","Peter","Rohit","Ananya"),
height = c(120,110,170,180,176,171,101))

height_data %>% ggplot(aes(name,height)) + geom_point(size = 2) + theme_minimal() + 
   theme(axis.title.x = element_text(size = 10),
         axis.title.y = element_text(size = 10))

Visualizations can surprise you !” - Hadley Wickham

3 small children, 2 parents, and 2 grandparents.

Therefore: 3 small t-shirts and 4 large t-shirts!

Visualize data as a table

height_data %>% kable()
name height
Anil 120
Bobby 110
Manju 170
Rekha 180
Peter 176
Rohit 171
Ananya 101

Visualize data as an ordered table

height_data %>% arrange(height) %>% kable()
name height
Ananya 101
Bobby 110
Anil 120
Manju 170
Rohit 171
Peter 176
Rekha 180

1 - variable plot

height_data %>% ggplot(aes(height)) + geom_bar() + 
  theme_minimal() + theme(axis.title = element_text(size = 10))

2 - variable plot

height_data %>% ggplot(aes(name,height)) + geom_point(size = 2) + 
  theme_minimal() + theme(axis.title = element_text(size = 10))

3 - variable plot

height_data %>% 
  mutate(state = c("KA","KA","TN","KA","KA","TN","KA")) -> height_data
height_data %>% 
  ggplot(aes(name,height, color = state)) + geom_point(size = 2) + 
  theme_minimal() + theme(axis.title = element_text(size = 10))

Possible scenario : Grandparents live in TN; parents and children live in KA!

4 - variable plot

height_data %>% 
  mutate(favorite_sport = c("Soccer","Soccer","Cricket","Hockey",
"Soccer","Hockey","Soccer")) %>% 
 ggplot(aes(name,height, color = state, shape = favorite_sport)) + 
  geom_point(size = 5) + 
  theme_minimal() + theme(axis.title = element_text(size = 10))

Children like soccer !

R and R-Studio Installation

Install R

https://cloud.r-project.org

Install R-Studio https://rstudio.com

Open R-Studio and run

install.packages(“tidyverse”)