darwin-eu-dev/TreatmentPatterns

createSankeyDiagram() like function that returns a googleVis::gvisSankey object

Closed this issue · 4 comments

Currently, the ´createSankeyDiagram()´ saves an HTML file.

In ReportGenerator, I modified the function so it returns a googleVis object, which can be rendered by Shiny with htmlOutput.

It would be convinient to have a ´createSunburstPlot()´ that returns an the googleVis::gvisSankey object to show in the preview of the shiny app.

Addressed in: 4b726b0

@cbarbozaerasmus Could you try out the following dummy code, and see if it is how you like it?

treatmentPathways <- data.frame(
  path = c("Acetaminophen", "Acetaminophen-Amoxicillin+Clavulanate",
           "Acetaminophen-Aspirin", "Amoxicillin+Clavulanate", "Aspirin"),
  freq = c(206, 6, 14, 48, 221),
  sex = rep("all", 5),
  age = rep("all", 5),
  index_year = rep("all", 5)
)

html <- createSankeyDiagram(
  treatmentPathways,
  outputHTML = TRUE
)

It works, thanks a lot!

The final parameter will be outputHTML or returnHTML?

returnHTML, with default: FALSE