Skip to content

Instantly share code, notes, and snippets.

@rshyam1
Created May 1, 2016 21:15
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/e37f2f7b7dde30a64bf387bdfea0cf9f to your computer and use it in GitHub Desktop.
Save rshyam1/e37f2f7b7dde30a64bf387bdfea0cf9f to your computer and use it in GitHub Desktop.
# Changing Marital status numerical values to facors
married_vec=c(1,2,3)
married_desc=c("married","single","others")
credi_tbl_temp$MARRIAGE=factor(x=credit_tbl$MARRIAGE,levels=married_vec,labels=married_desc)
# Crearing Marrital Status bar chart with fill
m=ggplot(data = credi_tbl_temp, aes(x = default.payment.next.month)) +
geom_bar(aes (fill = MARRIAGE), position = "fill") + ggtitle("Marital Status of Default Vs. Non Default")+ xlab("")
m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment