3
Iは、以下のようなデータを持っている:ggplot滑らかな線GLMモデル
numbers <- structure(list(density = c(1L, 4L, 10L, 22L, 55L, 121L, 210L,
444L), females = c(1L, 3L, 7L, 18L, 22L, 41L, 52L, 79L), males = c(0L,
1L, 3L, 4L, 33L, 80L, 158L, 365L), maleProp = c(0, 0.25, 0.3,
0.181818181818182, 0.6, 0.661157024793388, 0.752380952380952,
0.822072072072072), total = c(1L, 4L, 10L, 22L, 55L, 121L, 210L,
444L)), .Names = c("density", "females", "males", "maleProp",
"total"), row.names = c(NA, -8L), class = "data.frame")
Iはweight
としてtotal
とglm
方法滑らかなラインを持ちたいです。私はどのように私はこのような場合には滑らかなラインをプロットすることができ
Warning message:
Computation failed in `stat_smooth()`:
formal argument "weights" matched by multiple actual arguments
、私はエラーを得、
ggplot(numbers, aes(density, maleProp)) + geom_point() +
stat_smooth(method = "glm",
method.args = list(family = "binomial",
type = "response",
weights = "total"))
を試してみましたか?あなたが概説されたパラメータでglm
を使用したい場合は、次のよう
I:あなたは
ggplot2
オブジェクトに直接使用することができますあなたのコードを試して、それは働いた。それはあなたがパーサーを混乱させる何らかの理由で他に定義された '合計'を持つことができますか? –
[Zahiro Mor](http://stackoverflow.com/users/4700149/zahiro-mor)::これはggplotの古いバージョンかもしれません、ggplotのバージョンを更新してください、あなたは同じエラーになります。 – TheRimalaya