From af9125a29c8eeea03d0df861e524d7b59d20fcef Mon Sep 17 00:00:00 2001 From: Joseph Damiba Date: Thu, 1 Oct 2020 14:24:32 -0400 Subject: [PATCH] Update 2015-08-10-knitr.md --- _posts/r/chart-studio/2015-08-10-knitr.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/_posts/r/chart-studio/2015-08-10-knitr.md b/_posts/r/chart-studio/2015-08-10-knitr.md index 95b1324c4..2cf3df7e1 100644 --- a/_posts/r/chart-studio/2015-08-10-knitr.md +++ b/_posts/r/chart-studio/2015-08-10-knitr.md @@ -30,8 +30,8 @@ p <- plot_ly(economics, x = ~date, y = ~unemploy / pop) p ``` -
- +
+ Sometimes, you may want to print a _list_ of graphs in an RMarkdown document. @@ -42,10 +42,10 @@ If, for some reason, you don't want to use the [`subplot()` function](https://pl htmltools::tagList(list(p, p)) ``` -
+
- + Another way to print multiple graphs in an RMarkdown document with the `plotly` R package is by using the [`lapply`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/lapply) function: @@ -56,12 +56,12 @@ library(plotly) htmltools::tagList(lapply(1:3, function(x) { plot_ly(x = rnorm(10)) })) ``` -
+
- + Alternatively, you can use a `for` loop instead of `lapply`: @@ -76,12 +76,12 @@ for (i in 1:3) { l ``` -
+
- + ### Embedding Chart Studio Graphs in RMarkdown Files