R language Combat-how to analyze QQ Group Records 2-Daily Information Quantity chart

Source: Internet
Author: User

Idea steps:

1. Take the time data out from data.

2. Extract the date data from the time data.

3, according to date data to summarize the daily number of messages.

4, using Ggplot2 to draw.

#从data中获取时间信息time <-data$datetime# to extract the date attribute from the time p<-paste (year, Month (time), day, sep= "-") # Convert p to Data frame Timed<-data.frame (P) #通过P分组, p segment name becomes days, increment column Freq, GROUP by Quantity Fenzu<-sqldf ("Select P Days,count (*) Freq From Timed Group by P ") #上面fenzu后日期排序是混乱的, you need to sort the dates, from small to large #as.date () Convert the days column to a date #order () sort the dates from small to large fenzu<-fenzu[ Order (AS. Date (Fenzu$days)),] #利用ggplot开始作图 # data for the fenzu,x axis is the days,y axis for Freqggplot (Fenzu,aes (X=as). Date (days), y=freq) +  #绘制密度图, fill down the color to medium purple, transparency to 0.5    Geom_area (fill= "Mediumpurple1", alpha=0.5) +  #绘制顶点, The vertex is the? marker, the size is 3, the color is blue    geom_point (shape= "?", size=3,colour= "blue") +  #x坐标轴名称为时间, the y axis name is message density    xlab ("time") + Ylab ("message density") +  #设置图表的主题  theme_solarized_2 ()

Final Build:

R language Combat-how to analyze QQ Group Records 2-Daily Information Quantity chart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.