2017-07-06 90 views
-4

我拥有以下信用记录数据集。 german credit history在R中使用ggplot2绘制年龄组与性别

如何使用ggplot2绘制每个性别的年龄组(申请贷款)。

在此先感谢。

+4

请阅读[如何问一个好问题](http://stackoverflow.com/help/how-to-ask)以及如何给出一个[可重现的例子](http:// stackoverflow.com/questions/5963269)。这会让其他人更容易帮助你。 – zx8754

回答

0
library(ggplot) 
german_credit$Sex <- as.factor(german_credit$Sex) 
ggplot(german_credit, aes(x = Age)) + geom_histogram() + facet_wrap(~Sex)