darwin-eu-dev / TreatmentPatterns

An R package to analyze treatment patterns of a study population of interest 
https://darwin-eu-dev.github.io/TreatmentPatterns/
Apache License 2.0
7 stars 5 forks source link

Add download button for sankey and sunburst in module #227

Open mvankessel-EMC opened 9 months ago

mvankessel-EMC commented 9 months ago

Add download button for sankey and sunburst in module

mvankessel-EMC commented 9 months ago
tempFile <- tempfile(fileext = ".html")

dummyData <- data.frame(
  path = c("A+Z", "B", "C", "A-B", "B-C", "D+Z", "E", "F", "D-E", "D-E-F"),
  freq = c(25, 25, 25, 12, 13, 25, 25, 25, 12, 13),
  sex = rep("all", 10),
  age = rep("all", 10),
  index_year = c(rep("all", 5), rep("2020", 5))
)

s <- TreatmentPatterns::createSunburstPlot(dummyData, groupCombinations = FALSE)

htmlwidgets::saveWidget(s, file = tempFile)

webshot2::webshot(url = file.path("file:///", tempFile), file = "./s.png", )