It seems a typo. Perhaps this example has not been updated to take into account some changes in the structure of the object. After calling p <- plotly_build(p) we noticed that there is no p$data , but there is p$x$data . So, changing the lapply call to the following:
p$x$data <- lapply(p$x$data, FUN = function(x){ x$marker = list(opacity = 0) return(x) })
makes everything work as you like:

source share