Creating a dynamic chart displaying sequences of activities with their count in R

后端 未结 1 983
孤独总比滥情好
孤独总比滥情好 2021-01-27 19:56

If you run the R script below, the dataset \"patients\" is an eventlog of patients visiting a clinic and getting treatment. The trace explorer gets created as in the snapshot be

1条回答
  •  南方客
    南方客 (楼主)
    2021-01-27 20:31

    library(bupaR)
    library(plotly) 
    
    traces(patients, output_traces = T, output_cases = F)
    
    p <- trace_explorer(patients,type = "frequent", coverage = 1) +
    theme(axis.text.x=element_blank(),
          axis.ticks.x=element_blank(),
          axis.text.y=element_blank(),
          axis.ticks.y=element_blank())
    
    gg <- ggplotly(p)
    
    # Now manipulate the plotly object in the same way that 
    # we would manipulate any other plotly object
    # See https://plotly-book.cpsievert.me/extending-ggplotly.html
    layout(gg, margin=list(l=50, b=50), legend=list(x=1.05))
    

    0 讨论(0)
提交回复
热议问题