'Adding multiple frequency data to highchart barplot in R

I came across this website which show how to generate an interactive barplot using highchart. The frequency is called 'len' and I would like to know if there are len1, len2, len3 and len4, how do we include all len1–4 in highchart barplot?

I'm copying the R code they provide below:

# Load required R packages
library(highcharter) 
# Set highcharter options
options(highcharter.theme = hc_theme_smpl(tooltip = list(valueDecimals = 2)))

df <- data.frame(dose=c("D0.5", "D1", "D2"),
                len=c(4.2, 10, 29.5))


df2 <- data.frame(supp=rep(c("VC", "OJ"), each=3),
                dose=rep(c("D0.5", "D1", "D2"),2),
                len=c(6.8, 15, 33, 4.2, 10, 29.5))

hc <- df2 %>% 
  hchart('column', hcaes(x = 'dose', y = 'len', group = 'supp')) %>%
  hc_colors(c("#0073C2FF", "#EFC000FF"))

hc

Can someone gives some guidance? I hand drawn the plot that I mean. Thanks.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source