2016-11-12 60 views
-2

比較我有以下數據集創建一個明智的折線圖與平均實際

enter image description here

我想創建一個折線圖歷史平均水平比較VS 2016月度高速公路死亡事故。我想用圖形來使用ggplot。

我有一個以上的嘗試,但我仍然收到這樣的錯誤(錯誤:無法找到函數「GGPLOT2」)

ggplot(Homework_8_data, aes(x = Months)) + 

    geom_(aes(y = Ave_since_2002), colour="blue") + 

    geom_line(aes(y = X2016), colour = "grey") + 

    ylab(label="Average and actual highway fatalities") + 

    xlab(label="Months") 

我需要有人幫助我理解我做了錯誤,並糾正我。 感謝

回答

1

您必須安裝GGPLOT2:

install.packages("ggplot2")

,然後加載:

library(ggplot2)