<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Shiny Dashboard on Algoritma Technical Blog</title>
        <link>https://algolearn.netlify.app/tags/shiny-dashboard/</link>
        <description>Recent content in Shiny Dashboard on Algoritma Technical Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-us</language>
        <lastBuildDate>Tue, 26 Sep 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://algolearn.netlify.app/tags/shiny-dashboard/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>Deploy Machine Learning Model to Shinyapp</title>
        <link>https://algolearn.netlify.app/p/deploy-ml-to-shinyapp/</link>
        <pubDate>Tue, 26 Sep 2023 00:00:00 +0000</pubDate>
        
        <guid>https://algolearn.netlify.app/p/deploy-ml-to-shinyapp/</guid>
        <description>&lt;img src="https://algolearn.netlify.app/p/deploy-ml-to-shinyapp/img/theme.png" alt="Featured image of post Deploy Machine Learning Model to Shinyapp" /&gt;&lt;p&gt;body {
text-align: justify
}&lt;/p&gt;
&lt;img src=&#34;img/theme.png&#34; width=&#34;1000&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;In today&amp;rsquo;s fast-moving world, we often need to use complex tools like machine learning to make sense of data and solve problems. However, these tools can be pretty tricky to use, especially if you&amp;rsquo;re not a tech expert. That&amp;rsquo;s where Shiny comes in! Shiny is an open packages from RStudio, which provides a web application framework to create interactive web application called &lt;em&gt;Shiny apps&lt;/em&gt;. Shiny is like a magic wand for turning these powerful but confusing tools into easy-to-use web apps. While Shiny is often used to create interactive dashboard visualizations, in this article, we&amp;rsquo;ll explore a slightly different but equally exciting aspect of Shiny: deploying machine learning models. We&amp;rsquo;ll see how Shiny makes it super simple to deploy your machine learning creations, even if you&amp;rsquo;re not a tech whiz. So, let&amp;rsquo;s dive into the world of Shiny and discover how it can bring the power of machine learning to your fingertips in our fast-paced digital age.&lt;/p&gt;
&lt;p&gt;In broad strokes, here are the steps we&amp;rsquo;ll be exploring in this article:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Getting to know Shiny!&lt;/li&gt;
&lt;li&gt;Saving Your Machine Learning Model as an RDS File&lt;/li&gt;
&lt;li&gt;Connecting the Machine Learning Model and Shiny Input through Action Button&lt;/li&gt;
&lt;li&gt;Deploying to shinyapps.io&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In this article, we will explore the employee turnover prediction dashboard, which you can access at &lt;a class=&#34;link&#34; href=&#34;https://algoritmadatascience.shinyapps.io/Dashboard-Employee-Turnover/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://algoritmadatascience.shinyapps.io/Dashboard-Employee-Turnover/&lt;/a&gt;, and it will provide an overview like this:&lt;/p&gt;
&lt;img src=&#34;img/overview_dashboard.png&#34; width=&#34;960&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;Let&amp;rsquo;s get started!&lt;/p&gt;
&lt;h2 id=&#34;getting-to-know-shiny&#34;&gt;Getting to know Shiny!&lt;/h2&gt;
&lt;p&gt;Before we dive into the technical stuff, let&amp;rsquo;s get familiar with Shiny and its main parts. A basic Shiny app is like building with three important R scripts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;global.R&lt;/code&gt;&lt;/strong&gt;: Think of this as the backstage manager. It gets everything ready for your app&amp;rsquo;s performance. Here, you gather the tools you&amp;rsquo;ll need (like libraries), bring in the props (your data), and make sure everything is set up just right.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ui.R&lt;/code&gt;&lt;/strong&gt;: This is where you design the look of your app. Imagine it as the stage where your audience sees everything. You decide how it should appear, what buttons and sliders the audience can use, and how it all fits together.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;server.R&lt;/code&gt;&lt;/strong&gt;: Now, this is where the real action happens. Think of it as the engine of your app. In the server script, you make things happen based on what the audience (your app&amp;rsquo;s users) does. You listen to their requests, do some magic behind the scenes (like processing data or running models), and then show them the results.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These three scripts work together, like a team putting on a play. global.R sets up the backstage, ui.R designs the stage, and server.R directs the performance. Together, they create a web app that can do cool stuff, like showing data or even deploying machine learning models. If you&amp;rsquo;re feeling uncertain about where to begin your journey into learning Shiny, a valuable resource is the book &amp;ldquo;Mastering Shiny&amp;rdquo; by O&amp;rsquo;Reilly Media, which provides comprehensive insights. You can access it online through this link: &lt;a class=&#34;link&#34; href=&#34;https://mastering-shiny.org/basic-intro.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Mastering Shiny&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;saving-your-machine-learning-model-as-an-rds-file&#34;&gt;Saving Your Machine Learning Model as an RDS File&lt;/h2&gt;
&lt;p&gt;First, of course, we need to have a machine learning model that we will deploy in Shiny. To make the process more efficient and secure, it is advisable to store the machine learning model in &lt;code&gt;RDS&lt;/code&gt; format. This ensures that when it is deployed in Shiny, it does not consume excessive memory or time. Here is an example of how to save a random forest model in RDS format using the &lt;code&gt;saveRDS()&lt;/code&gt; function and store it with the name &lt;code&gt;randomforest.RDS&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;9
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;set.seed(417)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;control &amp;lt;- trainControl(method = &amp;#34;repeatedcv&amp;#34;, number = 10, repeats = 10)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# build model
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;model &amp;lt;- train(x = data_train[,-27],y = data_train[,27],method = &amp;#34;rf&amp;#34;, trControl = control)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# save model
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;saveRDS(model, &amp;#34;randomforest.RDS&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;connecting-the-machine-learning-model-and-shiny-input-through-action-button&#34;&gt;Connecting the Machine Learning Model and Shiny Input through Action Button&lt;/h2&gt;
&lt;h3 id=&#34;creating-shiny-input-for-model-prediction&#34;&gt;Creating Shiny Input for Model Prediction&lt;/h3&gt;
&lt;p&gt;In the &amp;ldquo;Dashboard Employee Turnover&amp;rdquo;, we have 4 shiny input sections, which contain the predictor variables needed by the machine learning model that has been created, as shown in the following image.&lt;/p&gt;
&lt;img src=&#34;img/predictor_input.png&#34; width=&#34;783&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;In running a machine learning model, we undoubtedly need input predictor variables so that the model can function. These predictors are incorporated into the model through shiny inputs located in the &lt;code&gt;ui.R&lt;/code&gt; script, and you can design them as creatively as you like. This time, we&amp;rsquo;ve placed these predictors into a &lt;strong&gt;collapsible box&lt;/strong&gt;, which is a box that can be opened or closed when clicked. In the image above, each box is labeled with instructions that the user needs to follow if they want to use this dashboard. This is the title of the open box is &lt;strong&gt;&amp;ldquo;Please complete this survey based on employee answers.&amp;rdquo;&lt;/strong&gt;. The collapsible box we use is optional. You can explore the Shiny structure further and choose other options by reading the following link: &lt;a class=&#34;link&#34; href=&#34;https://rstudio.github.io/shinydashboard/structure.html#structure-overview&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Structure Shiny&lt;/a&gt;.&lt;/p&gt;
&lt;img src=&#34;img/survey_input.png&#34; width=&#34;407&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;In that box, we present predictor variables in the form of a survey using &lt;code&gt;sliderInput()&lt;/code&gt;. If you wish to select a different type of input, you can check it out at the following link: &lt;a class=&#34;link&#34; href=&#34;https://shiny.posit.co/r/gallery/widgets/widget-gallery/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;shiny input&lt;/a&gt; or &lt;a class=&#34;link&#34; href=&#34;https://shinyapps.dreamrs.fr/shinyWidgets/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;more&lt;/a&gt;. The example code in the collapsible box above is as follows.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;23
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;24
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;25
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;26
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;27
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;28
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;29
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;30
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;31
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;32
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;33
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;34
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;35
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;36
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;37
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;38
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;39
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;40
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;41
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;42
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;43
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;box(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  title = &amp;#34;Please complete this survey based on employee answers!&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  solidHeader = TRUE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  enable_label = TRUE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  status = &amp;#34;primary&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  collapsible = TRUE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  collapsed = TRUE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  width = 6,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  p(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &amp;#34;These questions provide insights into various aspects of the work environment using a simple 5-point scale.&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  ),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  sliderInput(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    inputId = &amp;#34;ENVIRONMENT_SATISFACTION&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    label = &amp;#34;1. How satisfied are you with your current work environment?&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    min = 1, max = 5, value = 1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  ),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  sliderInput(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    inputId = &amp;#34;JOB_INVOLVEMENT&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    label = &amp;#34;2. How involved do you feel in your current job?&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    min = 1, max = 5, value = 1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  ),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  sliderInput(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    inputId = &amp;#34;JOB_SATISFACTION&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    label = &amp;#34;3. How satisfied are you with your current job?&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    min = 1, max = 5, value = 1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  ),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  sliderInput(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    inputId = &amp;#34;PERFORMANCE_RATING&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    label = &amp;#34;4. How would you rate your overall performance in your role?&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    min = 1,  max = 5, value = 1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  ),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  sliderInput(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    inputId = &amp;#34;WORK_LIFE_BALANCE&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    label = &amp;#34;5. How satisfied are you with your work-life balance?&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    min = 1, max = 5, value = 1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  ),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  sliderInput(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    inputId = &amp;#34;RELATIONSHIP_SATISFACTION&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    label = &amp;#34;6. How satisfied are you with your work relationship?&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    min = 1, max = 5, value = 1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  )
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h3 id=&#34;connecting-the-machine-learning-model-with-shiny-input&#34;&gt;Connecting the Machine Learning Model with Shiny Input&lt;/h3&gt;
&lt;h4 id=&#34;action-button&#34;&gt;Action Button&lt;/h4&gt;
&lt;img src=&#34;img/actionbutton.png&#34; width=&#34;443&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;We will link the shiny input to the machine learning model using a button on the dashboard called an action button. You can create an action button using the &lt;code&gt;actionButton(inputId = &amp;quot;action&amp;quot;, label = &amp;quot;Check the Result!&amp;quot;)&lt;/code&gt; function in &lt;code&gt;ui.R&lt;/code&gt;. It has two parameters: &lt;code&gt;inputId&lt;/code&gt;, which will be used to identify the action button in server.R, and &lt;code&gt;label&lt;/code&gt;, which is used to name the action button in &lt;code&gt;ui.R&lt;/code&gt;. Then, in &lt;code&gt;server.R&lt;/code&gt;, we will use the action button as a condition. If the action button is clicked, a process in &lt;code&gt;server.R&lt;/code&gt; will be executed. To gain a deeper understanding of the Action Button in Shiny, we recommend referring to the &lt;a class=&#34;link&#34; href=&#34;https://shiny.posit.co/r/articles/build/action-buttons/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;official documentation of action button&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&#34;connecting-action-button-with-the-shiny-input&#34;&gt;Connecting action button with the shiny input&lt;/h4&gt;
&lt;p&gt;After creating the action button, we can proceed to &lt;code&gt;server.R&lt;/code&gt;, which is where we execute various processes to obtain the output from the machine learning model. In &lt;code&gt;server.R&lt;/code&gt;, we will identify the inputs entered in &lt;code&gt;ui.R&lt;/code&gt; and run our machine learning model to predict the input data that has been provided. To understand how the action button connects shiny input and machine learning, please observe the following code in &lt;code&gt;server.R&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;23
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;24
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;25
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;26
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;27
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;28
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;29
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;30
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;31
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;32
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;33
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;34
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;35
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;name &amp;lt;- eventReactive(input$action, input$NAME)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;test_data &amp;lt;- eventReactive(input$action, {
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  data_input &amp;lt;- data.frame(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    AGE = input$AGE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    DAILY_RATE = input$DAILY_RATE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    DISTANCE_FROM_HOME = input$DISTANCE_FROM_HOME,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    EDUCATION = input$EDUCATION,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    ENVIRONMENT_SATISFACTION = input$ENVIRONMENT_SATISFACTION,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    GENDER = input$GENDER,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    HOURLY_RATE = input$HOURLY_RATE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    JOB_INVOLVEMENT = input$JOB_INVOLVEMENT,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    JOB_LEVEL = input$JOB_LEVEL,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    JOB_SATISFACTION = input$JOB_SATISFACTION,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    MARITAL_STATUS = input$MARITAL_STATUS,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    MONTHLY_INCOME = input$MONTHLY_INCOME,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    MONTHLY_RATE = input$MONTHLY_RATE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    NUM_COMPANIES_WORKED = input$NUM_COMPANIES_WORKED,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    PERCENT_SALARY_HIKE = input$PERCENT_SALARY_HIKE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    PERFORMANCE_RATING = input$PERFORMANCE_RATING,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    RELATIONSHIP_SATISFACTION = input$RELATIONSHIP_SATISFACTION,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    STANDARD_HOURS = input$STANDARD_HOURS,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    STOCK_OPTION_LEVEL = input$STOCK_OPTION_LEVEL,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    TOTAL_WORKING_YEARS = input$TOTAL_WORKING_YEARS,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    TRAINING_TIMES_LAST_YEAR = input$TRAINING_TIMES_LAST_YEAR,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    WORK_LIFE_BALANCE = input$WORK_LIFE_BALANCE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    YEARS_AT_COMPANY = input$YEARS_AT_COMPANY,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    YEARS_IN_CURRENT_ROLE = input$YEARS_IN_CURRENT_ROLE,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    YEARS_SINCE_LAST_PROMOTION = input$YEARS_SINCE_LAST_PROMOTION,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    YEARS_WITH_CURR_MANAGER = input$YEARS_WITH_CURR_MANAGER
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  )
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  data_predict &amp;lt;- data_input %&amp;gt;% mutate_at(colnames(data_input), as.numeric)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;})
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The code above shows that we are storing the inputs entered in &lt;code&gt;ui.R&lt;/code&gt; to &lt;code&gt;server.R&lt;/code&gt; for further processing. Since the dashboard requires various inputs, such as employee names using &lt;code&gt;textInput()&lt;/code&gt; in &lt;code&gt;ui.R&lt;/code&gt;, we save them as a function called &lt;code&gt;name()&lt;/code&gt; in &lt;code&gt;server.R&lt;/code&gt; using the &lt;code&gt;eventReactive()&lt;/code&gt; function with parameters &lt;code&gt;inputID&lt;/code&gt; from &lt;code&gt;actionButton()&lt;/code&gt; and &lt;code&gt;textInput()&lt;/code&gt;. The way the &lt;code&gt;eventReactive()&lt;/code&gt; function works is that when the action button is clicked, the shiny input from &lt;code&gt;textInput()&lt;/code&gt; is stored in a function called &lt;code&gt;name()&lt;/code&gt;. Because the predictors for the machine learning model in this dashboard are in dataframe format, we proceed to create a dataframe using &lt;code&gt;eventReactive()&lt;/code&gt;. We also perform data preprocessing, which in this case involves changing the data type of all predictor variables to numeric. &lt;strong&gt;It&amp;rsquo;s important to note that when saving predictor inputs in &lt;code&gt;server.R&lt;/code&gt;, you should create the input data exactly the same as when building the machine learning model to be used, including any data preprocessing steps.&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&#34;connecting-shiny-input-with-the-machine-learning-using-action-button&#34;&gt;Connecting shiny input with the machine learning using action button&lt;/h4&gt;
&lt;p&gt;After the action button is connected to the input data, the next step is to process the input data through the machine learning model so that we can generate prediction outputs from our model in &lt;code&gt;ui.R&lt;/code&gt;. Here is an overview of the Employee Turnover Prediction dashboard output.&lt;/p&gt;
&lt;img src=&#34;img/output_model.png&#34; width=&#34;748&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;We will carry out this process within &lt;code&gt;server.R&lt;/code&gt;. The process involves making predictions from the preprocessed input data using the machine learning model that we have saved as an RDS file. It&amp;rsquo;s important to note that the prediction function performed should be tailored to the type of machine learning used and the desired output. Here is an example of the code for a prediction function for a random forest model that generates the probability of employee turnover:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;prediction &amp;lt;- eventReactive(input$action, {
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  rf_model &amp;lt;- readRDS(&amp;#34;data_input/randomforest.RDS&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  pred &amp;lt;- predict(rf_model, test_data(), type = &amp;#34;prob&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  pred[,2]
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;})
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;To make the output of machine learning predictions displayed on the dashboard more informative, we can also modify it. In this case, we want to present the results in the form of a narrative, indicating whether the employees we input into the dashboard are predicted to be likely to leave the company or stay in the company. Since the output is in text format, we use the &lt;code&gt;renderText()&lt;/code&gt; function in &lt;code&gt;server.R&lt;/code&gt;, paired with this code snippet, which is &lt;code&gt;verbatimTextOutput()&lt;/code&gt; in &lt;code&gt;ui.R&lt;/code&gt;. To gain a better grasp of the necessary outputs to utilize in both the &lt;code&gt;server.R&lt;/code&gt; and &lt;code&gt;ui.R&lt;/code&gt; files, we recommend consulting the &lt;a class=&#34;link&#34; href=&#34;https://raw.githubusercontent.com/rstudio/cheatsheets/main/shiny.pdf&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Shiny cheatsheet&lt;/a&gt;. Here is an example of the code in &lt;code&gt;server.R&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;output$text_result &amp;lt;- renderText({
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    prediksi &amp;lt;- as.numeric(prediction() &amp;gt; 0.5) %&amp;gt;% as.factor()
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    decode &amp;lt;- function(x){
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      case_when(x == &amp;#34;1&amp;#34; ~ paste0(&amp;#34;likely to leave the company with probability of &amp;#34;, round(prediction()*100,1),&amp;#34;%.&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                x == &amp;#34;0&amp;#34; ~ &amp;#34;likely to stay in the company.&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      )}
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    paste0(name(), &amp;#34; is &amp;#34;, decode(prediksi))
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  })
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;deploying-to-shinyappsio&#34;&gt;Deploying to shinyapps.io&lt;/h2&gt;
&lt;p&gt;After successfully running your prediction dashboard on your local computer, the final step is to deploy it to Shinyapps on the web, allowing easy access for many people. You can find detailed steps on how to deploy Shinyapps to the web at &lt;a class=&#34;link&#34; href=&#34;https://shiny.posit.co/r/articles/share/deployment-web/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;this official shiny link&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Don&amp;rsquo;t panic if you encounter any failures during deployment, as this is a common occurrence. You can troubleshoot the errors by running the code &lt;code&gt;rsconnect::showLogs()&lt;/code&gt; in the RStudio Console and resolving the identified issues. Typically, these errors are related to missing package dependencies. You can also refer to the &lt;a class=&#34;link&#34; href=&#34;https://docs.posit.co/shinyapps.io/Troubleshooting.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Posit documentation&lt;/a&gt; for troubleshooting deployment errors.&lt;/p&gt;
&lt;p&gt;Here is the core process when we want to deploy a machine learning model in a Shiny app. In fact, you can explore many more possibilities for deploying machine learning models according to the design you desire because Shiny is highly flexible. You can view the following &lt;a class=&#34;link&#34; href=&#34;https://shiny.posit.co/r/gallery/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Shiny gallery&lt;/a&gt; to explore Shiny designs more extensively. There, you&amp;rsquo;ll even find example code to help you get started. Once you have a grasp of how Shiny works, creating useful and visually appealing web applications using Shiny will become very straightforward. Unlock the limitless potential of Shiny and let your creativity run wild in deploying machine learning models that not only work efficiently but also look stunning. Learning will never stop, so keep exploring the exciting world of data science!&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://mastering-shiny.org/basic-intro.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Mastering Shiny by O&amp;rsquo;Reilly Media&lt;/a&gt;
&lt;a class=&#34;link&#34; href=&#34;https://rstudio.github.io/shinydashboard/structure.html#structure-overview&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Structure Shiny&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://shiny.posit.co/r/gallery/widgets/widget-gallery/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Shiny input&lt;/a&gt; or [more]&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://shiny.posit.co/r/articles/build/action-buttons/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Official documentation of action button&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://raw.githubusercontent.com/rstudio/cheatsheets/main/shiny.pdf&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Shiny cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://shiny.posit.co/r/articles/share/deployment-web/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;How to deploy Shinyapps to the web&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://docs.posit.co/shinyapps.io/Troubleshooting.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Posit documentation for troubleshooting deployment errors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://shiny.posit.co/r/gallery/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Shiny gallery&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        <item>
        <title>Advancing Your Shiny Application</title>
        <link>https://algolearn.netlify.app/p/advancing-your-shinyapp/</link>
        <pubDate>Wed, 28 Apr 2021 00:00:00 +0000</pubDate>
        
        <guid>https://algolearn.netlify.app/p/advancing-your-shinyapp/</guid>
        <description>&lt;img src="https://algolearn.netlify.app/p/advancing-your-shinyapp/img/3.png" alt="Featured image of post Advancing Your Shiny Application" /&gt;&lt;p&gt;Shiny is a very convenient tool that helps us create an app using R. It provides a wide range of layouts and widgets that you can add to an app. Common features in shiny may have been explained in many tutorials and courses, but other features that are more advanced require more exploration from the users with only brief documentation. In this article, let&amp;rsquo;s discuss some advanced features in shiny that commonly asked by users that may help you build better app.&lt;/p&gt;
&lt;h2 id=&#34;what-we-will-learn&#34;&gt;What We Will Learn&lt;/h2&gt;
&lt;p&gt;There are many interesting features in Shiny. To ease our learning, let&amp;rsquo;s split this exploration in several article. In this first article, we will be focusing on polishing the Shiny app interface! Below are the topics that we will explore:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Navigation Bar&lt;/li&gt;
&lt;li&gt;Add Image&lt;/li&gt;
&lt;li&gt;Formatted Text &amp;amp; Paragraph&lt;/li&gt;
&lt;li&gt;Themes&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;navigation-bar&#34;&gt;Navigation Bar&lt;/h2&gt;
&lt;p&gt;Making navigation bar (tab list on the top of the page) in Shiny is quite easy. You can use &lt;code&gt;navbarPage()&lt;/code&gt; before making any fluid page and layouting function. Here&amp;rsquo;s some example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# global
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;library(shiny)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# ui
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;navbarPage(title = &amp;#34;Shiny-Box&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Home&amp;#34;, 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    &amp;#34;content 1&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Sales Overview&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    &amp;#34;content 2&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Interactive Map&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    &amp;#34;content 3&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          )
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# server
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;function(input, output) {
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src=&#34;img/navbar1.png&#34; width=&#34;347&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;You can also inverse the color of navigation bar so that the bar fill will be black and have a white font color. Just use argument &lt;code&gt;inverse = T&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;9
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;navbarPage(title = &amp;#34;Shiny-Box&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Home&amp;#34;, 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    &amp;#34;content 1&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Sales Overview&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    &amp;#34;content 2&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Interactive Map&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    &amp;#34;content 3&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           inverse = T
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           )
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src=&#34;img/navbar2.png&#34; width=&#34;345&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;Even more, you can customize the whole app color palette and visuals with the help of additional package. But, we will discuss this in a separate section in this article.&lt;/p&gt;
&lt;p&gt;If you want to custom the content for each page, you can use &lt;code&gt;fluidPage()&lt;/code&gt; function inside the &lt;code&gt;tabPanel()&lt;/code&gt; as usual and work with layout functions, positioning inputs and outputs.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;navbarPage(title = &amp;#34;Shiny-Box&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Home&amp;#34;, 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    &amp;#34;content 1&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           # fill content for tab 2
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Sales Overview&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    fluidPage(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                        sidebarLayout(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                            sidebarPanel(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                selectInput(&amp;#34;status&amp;#34;, label = &amp;#34;Status of Purchase:&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                            choices = c(&amp;#34;Purchased&amp;#34;, &amp;#34;Cancelled&amp;#34;)),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                            ),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                            mainPanel(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                                p(&amp;#34;There will be plot here&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                            )
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                        )
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    )),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           tabPanel(title = &amp;#34;Interactive Map&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    &amp;#34;content 3&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           inverse = T
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src=&#34;img/navbar3.png&#34; width=&#34;520&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;There it is the navbar! Meanwhile, if you prefer the navbar on the left side of the app (most similar to sidebar but can contain several tabPanels), you can use the &lt;code&gt;navlistPage()&lt;/code&gt; function instead. Here&amp;rsquo;s the detailed &lt;a class=&#34;link&#34; href=&#34;https://shiny.rstudio.com/articles/layout-guide.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;documentation&lt;/a&gt; on application layout in Shiny. Another option is to use &lt;a class=&#34;link&#34; href=&#34;https://rstudio.github.io/shinydashboard/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;&lt;strong&gt;shinydashboard&lt;/strong&gt;&lt;/a&gt; package instead and use the templates they already provided, with side note that you cannot use navbar on the top of the page.&lt;/p&gt;
&lt;h2 id=&#34;adding-image&#34;&gt;Adding Image&lt;/h2&gt;
&lt;p&gt;To add an image in Shiny is done by using &lt;code&gt;renderImage()&lt;/code&gt; function. The official documentation can be found &lt;a class=&#34;link&#34; href=&#34;https://shiny.rstudio.com/articles/images.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;here&lt;/a&gt;, but perhaps a more detailed example below can help you understand how it works.&lt;/p&gt;
&lt;p&gt;The most efficient way to add an image is by storing the image file in a sub-directory named &lt;code&gt;www&lt;/code&gt; inside your app folder. Below is an example:&lt;/p&gt;
&lt;img src=&#34;img/image1.png&#34; width=&#34;312&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;And then we can display it in the app with function &lt;code&gt;renderImage()&lt;/code&gt; and &lt;code&gt;imageOutput()&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# ui: code in the first tabPanel 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tabPanel(title = &amp;#34;Home&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         imageOutput(&amp;#34;home_img&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         )
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# add output in server
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;output$home_img &amp;lt;- renderImage({
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    list(src = &amp;#34;www/header_img.png&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         width = &amp;#34;100%&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         height = 330)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  }, deleteFile = F)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src=&#34;img/image2.png&#34; width=&#34;908&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;Notice that the &lt;code&gt;renderImage()&lt;/code&gt; function will source the image file from our &lt;code&gt;www&lt;/code&gt; folder (yes, it has to be named &amp;ldquo;www&amp;rdquo; so that we can camouflage it as an URL). We can also set the width and height of the image in percent or in pixel. In the code, we can also set argument &lt;code&gt;deleteFile = F&lt;/code&gt; so that the image will not be deleted once it has been rendered.&lt;/p&gt;
&lt;h2 id=&#34;formatting-text--paragraph&#34;&gt;Formatting Text &amp;amp; Paragraph&lt;/h2&gt;
&lt;p&gt;We can add formatted text easily in shiny by using &lt;strong&gt;HTML tags&lt;/strong&gt; that are listed on the page 2 of Shiny cheat sheet. Common tags also have wrapper function that will ease your way with formatting text and paragraph. Below are some example:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Add paragraph&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The most common task is to add a paragraph by using &lt;code&gt;p()&lt;/code&gt;. You can add text inside with a quotation marks &lt;code&gt;&amp;quot;&amp;quot;&lt;/code&gt;. You can also add text with specific font face (bold, italic, ect.), links and other forms of formatted text.&lt;/p&gt;
&lt;p&gt;Inside the function, before adding any text, you can also set &lt;strong&gt;css attributes&lt;/strong&gt; that will be applied to all text inside the paragraph. This is done by using &lt;code&gt;style = ...&lt;/code&gt; argument. Here&amp;rsquo;s an example below:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;p(style = &amp;#34;text-align: justify; font-size = 16px&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &amp;#34;text here&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;strong&gt;2. Font face &amp;amp; links&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bold: by adding wrapper functions &lt;code&gt;strong(&amp;quot;text here&amp;quot;)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Italic: by adding wrapper functions &lt;code&gt;em(&amp;quot;text here&amp;quot;)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Code: by adding wrapper functions &lt;code&gt;code(&amp;quot;text here&amp;quot;)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Link: by adding wrapper functions &lt;code&gt;a(href = &amp;quot;text here&amp;quot;, &amp;quot;link&amp;quot;)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;3. Horizontal line &amp;amp; breaks&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Horizontal line: &lt;code&gt;hr()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Breaks (add a new line): &lt;code&gt;br()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;4. Header&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can add header 1 until header 6 by using function &lt;code&gt;h1()&lt;/code&gt; and so on until &lt;code&gt;h6()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5. Blockquote&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Blockquote is not a common HTML tags and therefore shiny have not provided function for it. We can use the HTML tags &lt;code&gt;tags$blockquote&lt;/code&gt; instead. You can find other HTML tags in the Shiny cheat sheet. Below is an example code:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tags$blockquote(&amp;#34;This is a nice quote&amp;#34;, cite = &amp;#34;Anonymous&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;As you can see above, using HTML tags is no difference than using the HTML wrapper function. Use can use what is easier for you.&lt;/p&gt;
&lt;p&gt;Below is the example code to add formatted text and paragraph in Shiny:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;23
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;24
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# ui: code in the first tabPanel
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tabPanel(title = &amp;#34;Home&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         imageOutput(&amp;#34;home_img&amp;#34;, height = &amp;#34;320px&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         br(),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         hr(),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         h4(strong(&amp;#34;Project Description&amp;#34;)),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         p(style=&amp;#34;text-align: justify; font-size = 25px&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          &amp;#34;Shiny-Box is a Shiny application made with 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          the purpose of&amp;#34;, 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          em(&amp;#34;demonstrating various use of shiny features&amp;#34;), 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          &amp;#34;that are frequently asked by users but rarely 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          discussed in a beginner or formal class environment. 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          With an example app and its code, Shiny-Box hopefully 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          will ease your understanding on the mechanism 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          of various Shiny features. Go to&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          a(href = &amp;#34;https://github.com/NabiilahArdini/Shiny-Box&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &amp;#34;Shiny-Box GitHub Page&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;          &amp;#34;to find more details on the source code.&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                    
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         tags$blockquote(&amp;#34;Shiny-Box is still under continuous development. 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           Please look forward to future updates!&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;         hr()
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  )
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src=&#34;img/text1.png&#34; width=&#34;956&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;h2 id=&#34;themes&#34;&gt;Themes&lt;/h2&gt;
&lt;p&gt;A great user interface is the one that pleases the user&amp;rsquo;s eyes. Applying themes to our Shiny app will significantly boost the appearance of our app. Applying themes in shiny can be done using additional package. Previously common used package includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://rstudio.github.io/shinythemes/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;&lt;strong&gt;shinythemes&lt;/strong&gt;&lt;/a&gt;: for Shiny app&lt;/li&gt;
&lt;li&gt;&lt;a class=&#34;link&#34; href=&#34;https://github.com/nik01010/dashboardthemes&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;&lt;strong&gt;dashboardthemes&lt;/strong&gt;&lt;/a&gt; for Shiny dashboard&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But in the last February 2021, newer package called &lt;a class=&#34;link&#34; href=&#34;https://rstudio.github.io/bslib/index.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;&lt;strong&gt;bslib&lt;/strong&gt;&lt;/a&gt; was introduced in the official &lt;a class=&#34;link&#34; href=&#34;https://shiny.rstudio.com/articles/themes.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Shiny documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;bslib package allows users to apply modern versions of Bootstrap, Bootswatch themes, as well as custom themes in the app, and each theme be modified in real time! Below is the very basic way of using Bootswatch theme with bslib package. You may refer to the official documentation above while understanding the example code below:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# global
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;library(shiny)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;library(bslib)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# ui
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;navbarPage(title = &amp;#34;Shiny-Box&amp;#34;, 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           theme = bs_theme(bootswatch = &amp;#34;lux&amp;#34;),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           # &amp;lt;add tabPanels etc. from here on&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    )
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The code above will instruct Shiny to use Bootswatch theme &amp;ldquo;Lux&amp;rdquo;. Here&amp;rsquo;s the result:&lt;/p&gt;
&lt;img src=&#34;img/theme1.png&#34; width=&#34;936&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;Quite fascinating is it?! You can find other &lt;strong&gt;Bootswatch theme&lt;/strong&gt; &lt;a class=&#34;link&#34; href=&#34;https://bootswatch.com/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;here&lt;/a&gt;, or you can create your own theme easily by setting parameters within &lt;code&gt;bs_theme()&lt;/code&gt; function. You can edit the main background color (bg), foreground color (fg), accent colors (primary, secondary, etc), and fonts (base_font, heading_font, code_font, etc). Below is some example code and its result.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;# ui 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;navbarPage(title = &amp;#34;Shiny-Box&amp;#34;, 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           theme = bs_theme(bg = &amp;#34;white&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                            fg = &amp;#34;black&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                            primary = &amp;#34;maroon&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                            base_font = font_google(&amp;#34;Montserrat&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                            ),
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;           # &amp;lt;add tabPanels etc. from here on&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  )
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src=&#34;img/theme2.png&#34; width=&#34;953&#34; style=&#34;display: block; margin: auto;&#34; /&gt;
&lt;p&gt;For more features of bslib package such as customizing theme in real time, you can refer to the &lt;a class=&#34;link&#34; href=&#34;https://rstudio.github.io/bslib/articles/bslib.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;official documentation&lt;/a&gt; which thankfully quite easy to read!&lt;/p&gt;
&lt;p&gt;Last but not least, take a note here that the bslib package is originally made to be applied in Shiny app. If you wish to add theme to your Shiny dashboard, you still have to use the dashboardtheme package we&amp;rsquo;ve mentioned earlier.&lt;/p&gt;
&lt;p&gt;There are many other features of Shiny that can make your app more interesting, but we will finish it here for the part one of our exploration. Full code of the app demonstrated here can be found in the &lt;a class=&#34;link&#34; href=&#34;https://github.com/NabiilahArdini/Shiny-Box&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;GitHub Page&lt;/a&gt;. Please look forward to the next article that will be focused on exploring the reactive mechanism, inputs and outputs of Shiny. Until later!&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
