Im trying to use bar graph to observe the proportion of employees who left based on promotion.
Data: structure(list(promo = c(0, 0, 0, 0, 1, 1), left = c(0, 0, 0, 1, 0, 1)), .Names = c("promo", "left"), row.names = c(NA, -6L ), class = "data.frame")
Case 1: I used y = as.factor(left)
ggplot(data = HR, aes(x = as.factor(promotion), y =as.factor(left), fill = factor(promotion), colour=factor(promotion))) +
geom_bar(stat="identity")+
xlab('Promotion (True or False)')+
ylab('The Employees that quit')+
ggtitle('Comparision of Employees that resigned')
This produced the following graph.Case 1
Case 2: I used y = (left)
ggplot(data = HR, aes(x = as.factor(promotion), y = (left), fill = factor(promotion), colour=factor(promotion))) +
geom_bar(stat="identity")+
xlab('Promotion (True or False)')+
ylab('The Employees that quit')+
ggtitle('Comparision of Employees that resigned')
This produced the following graph. Case 2
What causes this difference and which graph should I make inference from?