I am converting ggplot2 charts using plotly and putting them in a knitr html output. Here is a working copy of the report. http://rpubs.com/kausti/NSEFO-23-Mar-2016 The fir
It turns out the problem is solved here https://github.com/ropensci/plotly/issues/273
knitr has known issues printing plotly charts in a loop. Quoting the final answer cpsievert from here
```{r}
l <- htmltools::tagList()
for (i in 1:3) {
l[[i]] <- as.widget(plot_ly(x = rnorm(10)))
}
l
```
This solved my problem. Though I ended up porting everything from ggplot2 to plotly R api before I found this solution.
MLavoie, thanks for your help. I had generated a dummy dataset just to create a reproducible example. Though your solution probably solves the dummy example, it is not all that relevant to me in the current problem. I think the solution provided here should be generic.
Thanks, Kaustubh