R Markdown

T1 <- aggregate(CreditScore ~ Geography, data = CCR, median)
T2 <- aggregate(Age ~ Geography, data = CCR, median)
T3 <- aggregate(Tenure ~ Geography, data = CCR, median)
T4 <- aggregate(Balance ~ Geography, data = CCR, mean)
T5 <- aggregate(NumOfProducts ~ Geography, data = CCR, median)
T6 <- aggregate(EstimatedSalary ~ Geography, data = CCR, mean)
T7 <- aggregate(`Satisfaction Score` ~ Geography, data = CCR, median)
T8 <- aggregate(`Point Earned` ~ Geography, data = CCR, median)
T1;T2;T3;T4;T5;T6;T7;T8
##   Geography CreditScore
## 1    France         653
## 2   Germany         651
## 3     Spain         651
##   Geography Age
## 1    France  37
## 2   Germany  38
## 3     Spain  37
##   Geography Tenure
## 1    France      5
## 2   Germany      5
## 3     Spain      5
##   Geography   Balance
## 1    France  62092.64
## 2   Germany 119730.12
## 3     Spain  61818.15
##   Geography NumOfProducts
## 1    France             1
## 2   Germany             1
## 3     Spain             2
##   Geography EstimatedSalary
## 1    France        99899.18
## 2   Germany       101113.44
## 3     Spain        99440.57
##   Geography Satisfaction Score
## 1    France                  3
## 2   Germany                  3
## 3     Spain                  3
##   Geography Point Earned
## 1    France          604
## 2   Germany          615
## 3     Spain          596

R Markdown

options( scipen = 999 )
library(RColorBrewer)
coul1 <- brewer.pal(3, "Set1") 
coul2 <- brewer.pal(3, "Set2") 
coul3 <- brewer.pal(3, "Set3") 
barplot(with(T1,setNames(CreditScore,Geography)),main="Credit Score vs. Geography",xlab = "Geography", ylab ="Credit Score", col=coul1)

barplot(with(T2,setNames(Age,Geography)),main="Age vs. Geography",xlab = "Geography", ylab ="Age",col=coul2)

barplot(with(T3,setNames(Tenure,Geography)),main="Tenure vs. Geography",xlab = "Geography", ylab ="Tenure",col=coul3)

barplot(with(T4,setNames(Balance,Geography)),main="Balance vs. Geography",xlab = "Geography", ylab ="Balance",col=coul1)

barplot(with(T5,setNames(NumOfProducts,Geography)),main="Number of Products vs. Geography",xlab = "Geography", ylab ="Number of Products",col=coul2)

barplot(with(T6,setNames(EstimatedSalary,Geography)),main="Estimated Salary vs. Geography",xlab = "Geography", ylab ="Estimated Salary",col=coul3)

barplot(with(T7,setNames(`Satisfaction Score`,Geography)),main="Satisfaction Score vs. Geography",xlab = "Geography", ylab ="Satisfaction Score",col=coul1)

barplot(with(T8,setNames(`Point Earned`,Geography)),main="Points Earned vs. Geography",xlab = "Geography", ylab ="Points Earned",col=coul2)