2

I have a working htmlwidget that does prints a matrix as a table and allows editing of that table. The widget is meant to be embedded into a shiny app as a demonstration of contingency tables. All the code is here:

https://github.com/richarddmorey/contingencyTablesShiny

The README gives instructions for how to start the shiny app.

Currently I have it working as an shiny input. This is pretty neat, because one can type in the matrix table and update the numbers, and the contingency table statistics dynamically update.

What I can't figure out how to do is connect the other shiny inputs to re-recreate the htmlwidget, e.g., to change the size of the table with shiny sliders. I gather I need to use the htmlwidget as a shiny output to do this, but I'm not sure how. When I try to change the widget to an output instead of an input (see commented out code here:

https://github.com/richarddmorey/contingencyTablesShiny/blob/master/ct/inst/shiny-apps/app1/ui.R#L48

and here:

https://github.com/richarddmorey/contingencyTablesShiny/blob/master/ct/inst/shiny-apps/app1/server.R#L18-L29

it fails to print any widget, and I get an error in the javascript console:

TypeError: undefined is not an object (evaluating 'a.replace')

in _processHtml — output_binding_html.js:190

Line where the error occurs

I suspect this has to do with how I'm sending the return value of the output render function for my widget, but I can't figure out why it won't work.

4

0 回答 0