I have a dataset basically with the columns of Month, Day of Week (Monday to Sunday), the Percentage of Traffic Congestion happened on that Day in that Month. So, I was trying to create a series of interactive pie plots by using nest(), map() and hchart(). However, when I run the code, no plots were produced and there's no error messages. Below is my code.
by_Month_pie <- Jam_DofW_Month_Ratio %>%
group_by(Month) %>%
nest() %>%
mutate(plot = map(data,
~hchart(
'pie', hcaes(x= DofWeek, y=Ratio),
name = paste("Month: ", Jam_DofW_Month_Ratio$Month)) + # (.)
facet_grid(Month)))
by_Month_pie$plot
The code below works well to produce an interactive pie chart.
hc <- hchart(Jam_DofW_Month_Ratio %>%
subset(Jam_DofW_Month_Ratio$Month == 'a5'),
"pie", hcaes(x = DofWeek, y = Ratio),
name = paste("Month: ", Jam_DofW_Month_Ratio$Month)
)
hc
I would be really grateful if any friend could help me to work this problem out. Thanks a lot!
Table with each day's percentage of congestions for each month