趨勢線
回到以 Height 對 Weight 的氣泡圖,並以 Gender 著色、篩選 20 歲的樣本。現在要加入趨勢線,並比較在有考量與未考量問卷權重時的趨勢線差異。
本練習屬於課程
在 R 中分析問卷資料
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Add non-survey-weighted trend lines to bubble plot
ggplot(data = NHANES20, mapping = aes(x = Height, y = Weight, size = WTMEC4YR, color = Gender)) +
geom_point(alpha = 0.1) +
guides(size = "none") +
geom____(method = ___, se = FALSE, linetype = 2)