How to replicate a Monthly Cycle Chart in R

后端 未结 3 1556
自闭症患者
自闭症患者 2021-02-08 06:47

I\'d like to output a chart similar to the one represented on this page (on the right) using R and any package that would make it look good:

http://processtrends.com/pg_

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-08 07:46

    The stats package in R base already has a function to do this. Here is my one-liner and the output that it produces

    monthplot(redata, labels = month.abb, ylab = 'Listings')
    

    enter image description here

    Building on this an example of using monthplot for a weekly cycle plot is here (gives full R code and source data): http://figshare.com/figures/index.php/OpenURL_Router_Data:_Total_Requests_by_Weekday

    monthplot(ts(sdf$values, frequency = 7, start=c(12,5)), labels = dow, ylab = "No. requests / day", xlab = "Weekday") 
    

    which gives this weekly cycle plot: Example of monthplot to create a graph showing a weekly cycle http://figshare.com/figures/images/a/a7/Total_requests_by_weekday_01_Apr_to_31_Jul_2011.jpeg

提交回复
热议问题