How to print htmlwidgets to HTML result inside a function?
--- title: "Untitled" output: html_document --- ```{r setup, include=FALSE} library(DT) xsx = function(){ print(getOption("viewer")) print(datatable(data.frame(d =1))) 1 } xsx() ``` Inside xsx() function, DT widgets will not be rendered in HTML result. How can I get widgets print inside a function? 来源: https://stackoverflow.com/questions/35567124/how-to-print-htmlwidgets-to-html-result-inside-a-function