I am generating reports using r-markdown, knitr, ggplot and plotly. My plot objects are passed in as parameters. I can generate ggplot output thus:
```{r echo = FALSE}
plot(params$plot_id__0_1)
```
However, if I try the same with a plotly object it fails (Error in xy.coords: 'x' is a list, but does not have components 'x' and 'y'):
```{r plotly = TRUE}
plot(params$plot_id__0_2)
```
I have seen r-markdown where plotly objects are evaulated in-place, so I have tried:
```{r plotly = TRUE}
params$plot_id__0_2
```
but I just get the text output "params$plot_id__0_2".
So the question is: how do I get my plotly output displayed in the report when the plotly object is input as a parameter? (I have included the ggplot2 and plotly packages in the markdown.)
Thanks for any advice.