library(dplyr)
variety <- rep(LETTERS[1:7], each=40)
treatment <- rep(c("high","low"), each=20)
note <- seq(1:280)+sample(1:150, 280, replace=TRUE)
ds <- data.frame(variety, note, treatment) |> group_by(treatment) |>
ec.data(format='boxplot')
ec.init(
dataset= ds$dataset,
series= ds$series,
yAxis= list(type= 'category', # categorical yAxis = horizontal boxplots
axisLabel= ds$axlbl),
xAxis= list(show= TRUE), # categorical xAxis = vertical boxplots
legend= list(show= TRUE)
)
ds <- airquality |> mutate(Day=round(Day/10)) |> relocate(Day,Wind) |> ec.data(format='boxplot')
ec.init(
dataset= ds$dataset,
series= ds$series,
yAxis= list(type= 'category'),
xAxis= list(show= TRUE),
legend= list(show= TRUE) #, tooltip= list(show=TRUE)
)
hc <- hclust(dist(USArrests), "complete")
ec.init(preset= FALSE,
series= list(list(
type= 'tree', orient= 'TB', roam= TRUE, initialTreeDepth= -1,
data= ec.data(hc, format='dendrogram'),
# layout= 'radial', symbolSize= ec.clmn(scale= 0.33),
## exclude added labels like 'pXX', leaving only the originals
label= list(formatter= htmlwidgets::JS(
"function(n) { out= /p\\d+/.test(n.name) ? '' : n.name; return out;}"))
))
)
Run the code above in your browser using DataLab