library(plotly)
stadata <-
read.csv("D:\\张志浩\\大数据班\\R语言实验-徐娇\\R第5次实训\\数据\\SY-20150401.csv")
获取17:00:00-17:05:00的数据
stadata$se<-period_to_seconds(hms(stadata$V3))
stadata<-filter(stadata,V6!=0 & se>=61200 & se<=61500)
stad<-substring(stadata['V4'][,],4)
stad<-data.frame(stad);
names(stad)[1]<-'station'
按站名排序并计算流量
stations<-stations[order(stations$station),]
count<-sqldf("select station, count(*) from stad group by station")
s<-merge(count,stations,by="station")
青年大街是1号线和2号线相交站,额外处理
names(s)[2] <- c('count')
s[17, 2] <- s[17, 2]*2
st <- s[-18,]
st <- st[order(-s$count),]
st<-st[1:5, 1:2]
plot_ly(st, x = ~ station, y = ~ count)%>%add_bars()
大家好,我是[爱做梦的子浩](https://blog.csdn.net/weixin_43124279),我是东北大学大数据实验班大三的小菜鸡,非常向往优秀,羡慕优秀的人,已拿两个暑假offer,欢迎大家找我进行交流😂😂😂
这是我的博客地址:[子浩的博客https://blog.csdn.net/weixin_43124279]
版权声明:本文为CSDN博主「爱做梦的子浩」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。