Created
May 1, 2016 19:47
-
-
Save rshyam1/f1107bac4aaa493bd61b689cb6c273e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# changing "sex" numerical values to factors | |
sex_vec=c(1,2) | |
sex_desc=c("male","female") | |
credi_tbl_temp$SEX=factor(x=credit_tbl$SEX,levels=sex_vec,labels=sex_desc) | |
# Creating Bar Plots for Gender as factors for fill and default as factor on x-axis | |
s=ggplot(data = credi_tbl_temp, aes(x = default.payment.next.month)) + | |
geom_bar(aes (fill = SEX), position = "fill") + | |
ggtitle("Gender Profile of Default Payment Vs Non-Default")+ | |
xlab("")+ylab("") | |
s | |
s1=ggplot(data = credi_tbl_temp, aes(x = default.payment.next.month)) + | |
geom_bar(aes (fill = SEX), position = "dodge") + | |
ggtitle("Gender Profile of Default Payment Vs Non-Default")+ | |
xlab("")+ylab("") | |
s1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment