R ヒストグラム 描画 ddply パッケージ Error : Mapping a variable to y and also using stat="bin".

 

エラー:

> ggplot(mau.payment.summary, aes(x = log_date, y = total.payment, fill=user_type))+geom_bar()+scale_y_continuous(label=comma)
Error : Mapping a variable to y and also using stat="bin".
With stat="bin", it will attempt to set the y value to the count of cases in each group.
This can result in unexpected behavior and will not be allowed in a future version of ggplot2.
If you want y to represent counts of cases, use stat="bin" and don't map a variable to y.
If you want y to represent values in the data, use stat="identity".
See ?geom_bar for examples. (Defunct; last used in version 0.9.2)

解決:
> ggplot(mau.payment.summary, aes(x = log_date, y = total.payment, fill=user_type))+geom_bar(stat="identity")+scale_y_continuous(label=comma)

参考:

『ビジネス活用事例で学ぶ データサイエンス入門』第3章のggplot2エラー対処法 - pychef’s diary

 

 

パッケージについて詳しいサイト:

Rのグラフィック作成パッケージ“ggplot2”について|Colorless Green Ideas