options(stringsAsFactors = F) rm(list = ls()) source("D:\\R\\packages\\Mreport\\scripts\\source_toglobal.R", encoding = "utf-8")
library(Mreport) library(plyr) library(ggplot2) library(reshape2) library(knitr)
load_base() load_sample_base()
jdg4_29 <- read.csv("D:\\data\\sx_raw\\交调数据\\jd2018_06_G4_29.csv") dim(jdg4_29)
jdg4_30 <- read.csv("D:\\data\\sx_raw\\交调数据\\jd2018_06_G4_30.csv") dim(jdg4_30)
jdg4_28 <- read.csv("D:\\data\\sx_raw\\交调数据\\jd2018_06_G4_28.csv") dim(jdg4_28)
hy28 <- jdg4_28[jdg4_28$地市名称=="衡阳市" & jdg4_28$行驶方向=="断面",] hy29 <- jdg4_29[jdg4_29$地市名称=="衡阳市" & jdg4_28$行驶方向=="断面",] hy30 <- jdg4_30[jdg4_30$地市名称=="衡阳市" & jdg4_28$行驶方向=="断面",]
x28 <- ddply(hy28,"小时",summarise,mean(机动车当量)) x28$小时 <- paste("28-",x28$小时,sep = "")
x29 <- ddply(hy29,"小时",summarise,mean(机动车当量)) x29$小时 <- paste("29-",x29$小时,sep = "")
x30 <- ddply(hy30,"小时",summarise,mean(机动车当量)) x30$小时 <- paste("30-",x30$小时,sep = "")
x <- rbind(x28,x29,x30);x %>% kable()
x <- rbind(x28,x29,x30) names(x) <- c("day","Wmean") x$day <- 1:nrow(x) ggplot(x,aes(x=day,y=Wmean))+geom_line(colour="steelblue")+geom_point(colour="steelblue")+ scale_x_continuous(breaks = seq(0,72,4))+ geom_point(aes(x=45,y=2390.333),colour="red",size=3)+ geom_point(aes(x=58,y=1362.333),colour="green",size=3)+ xlab("时刻")+ylab("平均机动车当量")
ggsave(filename = "D:\\交大云同步\\实习\\06_月度分析报告\\6月分析\\绘图\\G4车祸.png",width=9,height=5,dpi=600)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.