dash-canvas
dash-canvas copied to clipboard
Dash-canvas (R) and filter_null
Hello all,
I was trying to translate an applet from Python to R, but encountered a problem. The snippet I used was from the tutorial at: https://dashr.plotly.com/dash-canvas
And it was this:
app <- Dash$new()
app$layout(
htmlDiv(
list(
htmlH5("Press down the left mouse button and draw inside the canvas"),
dashCanvas(id = 'canvas_101')
)
)
)
app$run_server()
Which returns:
Error in filter_null(component$props) :
could not find function "filter_null"
Looking at the changelog https://github.com/plotly/dashR/blob/master/CHANGELOG.md, this function has been excised
I found the function to be:
filter_null <- function(x) {
if (length(x) == 0 || !is.list(x)) return(x)
x[!vapply(x, is.null, logical(1))]
}
And everything works normally afterwards.