Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarto GHA Workflow Runner committed Sep 21, 2023
1 parent c2a7953 commit 0bfd846
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
69dd0ac8
75248e7f
13 changes: 6 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2 id="toc-title">On this page</h2>

<ul>
<li><a href="#sample-application" id="toc-sample-application" class="nav-link active" data-scroll-target="#sample-application">Sample Application</a></li>
<li><a href="#tutorial-using-r-shinylive-for-static-shiny-apps-in-quarto-documents" id="toc-tutorial-using-r-shinylive-for-static-shiny-apps-in-quarto-documents" class="nav-link" data-scroll-target="#tutorial-using-r-shinylive-for-static-shiny-apps-in-quarto-documents">Tutorial: Using r-shinylive for Static Shiny Apps in Quarto Documents</a>
<li><a href="#using-r-shinylive-for-serverless-shiny-apps-in-quarto-documents" id="toc-using-r-shinylive-for-serverless-shiny-apps-in-quarto-documents" class="nav-link" data-scroll-target="#using-r-shinylive-for-serverless-shiny-apps-in-quarto-documents">Using r-shinylive for Serverless Shiny Apps in Quarto Documents</a>
<ul class="collapse">
<li><a href="#installation" id="toc-installation" class="nav-link" data-scroll-target="#installation">Installation</a></li>
<li><a href="#setting-up-your-quarto-project" id="toc-setting-up-your-quarto-project" class="nav-link" data-scroll-target="#setting-up-your-quarto-project">Setting Up Your Quarto Project</a></li>
Expand Down Expand Up @@ -194,7 +194,7 @@ <h1 class="title">R-shinylive app in Quarto!</h1>
<p>For the demo, we’re showing the source code used in Joe Cheng’s <a href="https://jcheng5.github.io/posit-conf-2023-shinylive/#/option-3-include-1">posit::conf(2023) demo</a> (Warning: Large file size, don’t open on mobile!) [<a href="https://github.com/jcheng5/posit-conf-2023-shinylive/blob/d385ad18eb0d867f25cc4721d9e8c25aeb2dfb90/slides.qmd#L299">Source Code</a>]</p>
<section id="sample-application" class="level2">
<h2 class="anchored" data-anchor-id="sample-application">Sample Application</h2>
<p>We’ll be walking through the process of creating the following R ShinyLive application. Please be aware that it may take some time to load.</p>
<p>We’ll be walking through the process of creating the following R Shinylive application. Please be aware that it may take some time to load.</p>
<pre class="shinylive-r" data-engine="r"><code>#| standalone: true
#| viewerHeight: 600
library(shiny)
Expand Down Expand Up @@ -250,8 +250,8 @@ <h2 class="anchored" data-anchor-id="sample-application">Sample Application</h2>
# Create Shiny app ----
shinyApp(ui = ui, server = server)</code></pre>
</section>
<section id="tutorial-using-r-shinylive-for-static-shiny-apps-in-quarto-documents" class="level1">
<h1>Tutorial: Using r-shinylive for Static Shiny Apps in Quarto Documents</h1>
<section id="using-r-shinylive-for-serverless-shiny-apps-in-quarto-documents" class="level1">
<h1>Using r-shinylive for Serverless Shiny Apps in Quarto Documents</h1>
<p>Are you interested in creating your own Quarto document with embedded static Shiny apps? This tutorial will guide you through the process of using the <code>r-shinylive</code> R package to achieve just that. Let’s get started!</p>
<section id="installation" class="level2">
<h2 class="anchored" data-anchor-id="installation">Installation</h2>
Expand Down Expand Up @@ -292,8 +292,7 @@ <h2 class="anchored" data-anchor-id="including-the-shiny-app-in-your-quarto-docu
<p><strong>Step 4:</strong> To include a Shiny app directly in your Quarto file (<code>.qmd</code>), you need to add a filter key for <code>shinylive</code> at the top of the desired Quarto file. Open your Quarto file and add the following YAML header:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode yaml code-with-copy"><code class="sourceCode yaml"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">filters</span><span class="kw">:</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="at"> </span><span class="kw">-</span><span class="at"> shinylive</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p><strong>Step 5:</strong> Place your Shiny application code within your Quarto file (<code>.qmd</code>) as shown in the following example:</p>
<p>You can insert the code for a Shiny application in a code block marked with <code>{shinylive-r}</code>. Below is a skeletal example of how your code block might look:</p>
<p><strong>Step 5:</strong> You can insert the code for a Shiny application in a code block marked with <code>{shinylive-r}</code>. Below is a skeletal example of how your code block might look:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode md code-with-copy"><code class="sourceCode markdown"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co">---</span></span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="an">title:</span><span class="co"> "Our first r-shinylive Quarto document!"</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="an">filters:</span></span>
Expand Down Expand Up @@ -376,7 +375,7 @@ <h2 class="anchored" data-anchor-id="including-the-shiny-app-in-your-quarto-docu
<span id="cb8-53"><a href="#cb8-53" aria-hidden="true" tabindex="-1"></a><span class="co"># Create Shiny app ----</span></span>
<span id="cb8-54"><a href="#cb8-54" aria-hidden="true" tabindex="-1"></a><span class="ex">shinyApp</span><span class="er">(</span><span class="ex">ui</span> = ui, server = server<span class="kw">)</span></span>
<span id="cb8-55"><a href="#cb8-55" aria-hidden="true" tabindex="-1"></a><span class="kw">```</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<p>You can view a standalone version of Joe’s app here: &lt;R-shinylive-demo.qmd&gt;</p>
<p>You can view a standalone version of Joe’s app here: <a href="https://github.com/coatless-quarto/r-shinylive-demo/blob/main/R-shinylive-demo.qmd">R-shinylive-demo.qmd</a></p>
</section>
<section id="rendering-your-quarto-document" class="level2">
<h2 class="anchored" data-anchor-id="rendering-your-quarto-document">Rendering Your Quarto Document</h2>
Expand Down
4 changes: 2 additions & 2 deletions search.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"href": "index.html#sample-application",
"title": "R-shinylive app in Quarto!",
"section": "Sample Application",
"text": "Sample Application\nWe’ll be walking through the process of creating the following R ShinyLive application. Please be aware that it may take some time to load.\n#| standalone: true\n#| viewerHeight: 600\nlibrary(shiny)\nlibrary(bslib)\n\n# Define UI for app that draws a histogram ----\nui &lt;- page_sidebar(\n sidebar = sidebar(open = \"open\",\n numericInput(\"n\", \"Sample count\", 100),\n checkboxInput(\"pause\", \"Pause\", FALSE),\n ),\n plotOutput(\"plot\", width=1100)\n)\n\nserver &lt;- function(input, output, session) {\n data &lt;- reactive({\n input$resample\n if (!isTRUE(input$pause)) {\n invalidateLater(1000)\n }\n rnorm(input$n)\n })\n \n output$plot &lt;- renderPlot({\n hist(data(),\n breaks = 40,\n xlim = c(-2, 2),\n ylim = c(0, 1),\n lty = \"blank\",\n xlab = \"value\",\n freq = FALSE,\n main = \"\"\n )\n \n x &lt;- seq(from = -2, to = 2, length.out = 500)\n y &lt;- dnorm(x)\n lines(x, y, lwd=1.5)\n \n lwd &lt;- 5\n abline(v=0, col=\"red\", lwd=lwd, lty=2)\n abline(v=mean(data()), col=\"blue\", lwd=lwd, lty=1)\n\n legend(legend = c(\"Normal\", \"Mean\", \"Sample mean\"),\n col = c(\"black\", \"red\", \"blue\"),\n lty = c(1, 2, 1),\n lwd = c(1, lwd, lwd),\n x = 1,\n y = 0.9\n )\n }, res=140)\n}\n\n# Create Shiny app ----\nshinyApp(ui = ui, server = server)"
"text": "Sample Application\nWe’ll be walking through the process of creating the following R Shinylive application. Please be aware that it may take some time to load.\n#| standalone: true\n#| viewerHeight: 600\nlibrary(shiny)\nlibrary(bslib)\n\n# Define UI for app that draws a histogram ----\nui &lt;- page_sidebar(\n sidebar = sidebar(open = \"open\",\n numericInput(\"n\", \"Sample count\", 100),\n checkboxInput(\"pause\", \"Pause\", FALSE),\n ),\n plotOutput(\"plot\", width=1100)\n)\n\nserver &lt;- function(input, output, session) {\n data &lt;- reactive({\n input$resample\n if (!isTRUE(input$pause)) {\n invalidateLater(1000)\n }\n rnorm(input$n)\n })\n \n output$plot &lt;- renderPlot({\n hist(data(),\n breaks = 40,\n xlim = c(-2, 2),\n ylim = c(0, 1),\n lty = \"blank\",\n xlab = \"value\",\n freq = FALSE,\n main = \"\"\n )\n \n x &lt;- seq(from = -2, to = 2, length.out = 500)\n y &lt;- dnorm(x)\n lines(x, y, lwd=1.5)\n \n lwd &lt;- 5\n abline(v=0, col=\"red\", lwd=lwd, lty=2)\n abline(v=mean(data()), col=\"blue\", lwd=lwd, lty=1)\n\n legend(legend = c(\"Normal\", \"Mean\", \"Sample mean\"),\n col = c(\"black\", \"red\", \"blue\"),\n lty = c(1, 2, 1),\n lwd = c(1, lwd, lwd),\n x = 1,\n y = 0.9\n )\n }, res=140)\n}\n\n# Create Shiny app ----\nshinyApp(ui = ui, server = server)"
},
{
"objectID": "index.html#installation",
Expand Down Expand Up @@ -46,7 +46,7 @@
"href": "index.html#including-the-shiny-app-in-your-quarto-document",
"title": "R-shinylive app in Quarto!",
"section": "Including the Shiny App in Your Quarto Document",
"text": "Including the Shiny App in Your Quarto Document\nStep 4: To include a Shiny app directly in your Quarto file (.qmd), you need to add a filter key for shinylive at the top of the desired Quarto file. Open your Quarto file and add the following YAML header:\nfilters:\n - shinylive\nStep 5: Place your Shiny application code within your Quarto file (.qmd) as shown in the following example:\nYou can insert the code for a Shiny application in a code block marked with {shinylive-r}. Below is a skeletal example of how your code block might look:\n---\ntitle: \"Our first r-shinylive Quarto document!\"\nfilters:\n - shinylive\n---\n\n```{shinylive-r}\n#| standalone: true\n\nlibrary(shiny)\n\n# Define your Shiny UI here\nui &lt;- fluidPage(\n # Your UI components go here\n)\n\n# Define your Shiny server logic here\nserver &lt;- function(input, output, session) {\n # Your server code goes here\n}\n\n# Create and launch the Shiny app\nshinyApp(ui, server)\n```\nPlease note that the code block must include #| standalone: true, which indicates that the code represents a complete standalone Shiny application. In the future, Quarto will hopefully support Shiny applications with parts spread throughout the document.\nFor an example file, you can refer to this bare-bones implementation: template-r-shinylive.qmd\nWith this in mind, let’s use Joe’s shiny app inside our code block. So, we’ll end up using:\n```{shinylive-r}\n#| standalone: true\n#| viewerHeight: 600\nlibrary(shiny)\n\n# Define UI for app that draws a histogram ----\nui &lt;- page_sidebar(\n sidebar = sidebar(open = \"open\",\n numericInput(\"n\", \"Sample count\", 100),\n checkboxInput(\"pause\", \"Pause\", FALSE),\n ),\n plotOutput(\"plot\", width=1100)\n)\n\nserver &lt;- function(input, output, session) {\n data &lt;- reactive({\n input$resample\n if (!isTRUE(input$pause)) {\n invalidateLater(1000)\n }\n rnorm(input$n)\n })\n \n output$plot &lt;- renderPlot({\n hist(data(),\n breaks = 40,\n xlim = c(-2, 2),\n ylim = c(0, 1),\n lty = \"blank\",\n xlab = \"value\",\n freq = FALSE,\n main = \"\"\n )\n \n x &lt;- seq(from = -2, to = 2, length.out = 500)\n y &lt;- dnorm(x)\n lines(x, y, lwd=1.5)\n \n lwd &lt;- 5\n abline(v=0, col=\"red\", lwd=lwd, lty=2)\n abline(v=mean(data()), col=\"blue\", lwd=lwd, lty=1)\n\n legend(legend = c(\"Normal\", \"Mean\", \"Sample mean\"),\n col = c(\"black\", \"red\", \"blue\"),\n lty = c(1, 2, 1),\n lwd = c(1, lwd, lwd),\n x = 1,\n y = 0.9\n )\n }, res=140)\n}\n\n# Create Shiny app ----\nshinyApp(ui = ui, server = server)\n```\nYou can view a standalone version of Joe’s app here: &lt;R-shinylive-demo.qmd&gt;"
"text": "Including the Shiny App in Your Quarto Document\nStep 4: To include a Shiny app directly in your Quarto file (.qmd), you need to add a filter key for shinylive at the top of the desired Quarto file. Open your Quarto file and add the following YAML header:\nfilters:\n - shinylive\nStep 5: You can insert the code for a Shiny application in a code block marked with {shinylive-r}. Below is a skeletal example of how your code block might look:\n---\ntitle: \"Our first r-shinylive Quarto document!\"\nfilters:\n - shinylive\n---\n\n```{shinylive-r}\n#| standalone: true\n\nlibrary(shiny)\n\n# Define your Shiny UI here\nui &lt;- fluidPage(\n # Your UI components go here\n)\n\n# Define your Shiny server logic here\nserver &lt;- function(input, output, session) {\n # Your server code goes here\n}\n\n# Create and launch the Shiny app\nshinyApp(ui, server)\n```\nPlease note that the code block must include #| standalone: true, which indicates that the code represents a complete standalone Shiny application. In the future, Quarto will hopefully support Shiny applications with parts spread throughout the document.\nFor an example file, you can refer to this bare-bones implementation: template-r-shinylive.qmd\nWith this in mind, let’s use Joe’s shiny app inside our code block. So, we’ll end up using:\n```{shinylive-r}\n#| standalone: true\n#| viewerHeight: 600\nlibrary(shiny)\n\n# Define UI for app that draws a histogram ----\nui &lt;- page_sidebar(\n sidebar = sidebar(open = \"open\",\n numericInput(\"n\", \"Sample count\", 100),\n checkboxInput(\"pause\", \"Pause\", FALSE),\n ),\n plotOutput(\"plot\", width=1100)\n)\n\nserver &lt;- function(input, output, session) {\n data &lt;- reactive({\n input$resample\n if (!isTRUE(input$pause)) {\n invalidateLater(1000)\n }\n rnorm(input$n)\n })\n \n output$plot &lt;- renderPlot({\n hist(data(),\n breaks = 40,\n xlim = c(-2, 2),\n ylim = c(0, 1),\n lty = \"blank\",\n xlab = \"value\",\n freq = FALSE,\n main = \"\"\n )\n \n x &lt;- seq(from = -2, to = 2, length.out = 500)\n y &lt;- dnorm(x)\n lines(x, y, lwd=1.5)\n \n lwd &lt;- 5\n abline(v=0, col=\"red\", lwd=lwd, lty=2)\n abline(v=mean(data()), col=\"blue\", lwd=lwd, lty=1)\n\n legend(legend = c(\"Normal\", \"Mean\", \"Sample mean\"),\n col = c(\"black\", \"red\", \"blue\"),\n lty = c(1, 2, 1),\n lwd = c(1, lwd, lwd),\n x = 1,\n y = 0.9\n )\n }, res=140)\n}\n\n# Create Shiny app ----\nshinyApp(ui = ui, server = server)\n```\nYou can view a standalone version of Joe’s app here: R-shinylive-demo.qmd"
},
{
"objectID": "index.html#rendering-your-quarto-document",
Expand Down
6 changes: 3 additions & 3 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://github.com/coatless-quarto/r-shinylive-demo/R-shinylive-demo.html</loc>
<lastmod>2023-09-21T09:24:42.567Z</lastmod>
<lastmod>2023-09-21T09:41:09.904Z</lastmod>
</url>
<url>
<loc>https://github.com/coatless-quarto/r-shinylive-demo/index.html</loc>
<lastmod>2023-09-21T09:24:37.803Z</lastmod>
<lastmod>2023-09-21T09:41:06.652Z</lastmod>
</url>
<url>
<loc>https://github.com/coatless-quarto/r-shinylive-demo/template-r-shinylive.html</loc>
<lastmod>2023-09-21T09:24:38.799Z</lastmod>
<lastmod>2023-09-21T09:41:07.352Z</lastmod>
</url>
</urlset>

0 comments on commit 0bfd846

Please sign in to comment.