Skip to content

Instantly share code, notes, and snippets.

@rshyam1
Created May 1, 2016 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rshyam1/f46ca1ef641f65deacbd422ae39bf10b to your computer and use it in GitHub Desktop.
Save rshyam1/f46ca1ef641f65deacbd422ae39bf10b to your computer and use it in GitHub Desktop.
#Changing Education numerical values to facotrs
edu_vec=c(1,2,3,4)
edu_desc=c("graduate school","university","high school","others")
credi_tbl_temp$EDUCATION=factor(x=credit_tbl$EDUCATION,levels=edu_vec,labels=edu_desc)
#Creating Bar Plots for Education as factors for fill and default as factor on x-axis
e2=ggplot(data = credi_tbl_temp, aes(x = default.payment.next.month)) +
geom_bar(aes (fill = EDUCATION), position = "dodge") +
ggtitle("Education Profile of Default Payment Vs Non-Default")+
xlab("")+ylab("Number of Individuals")
e2
# Education bar with fill
e3=ggplot(data = credi_tbl_temp, aes(x = default.payment.next.month)) +
geom_bar(aes (fill = EDUCATION), position = "fill") +
ggtitle("Education Profile of Default Payment Vs Non-Default")+
xlab("")+ylab("")
e3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment