<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>shiny Archives - Ger Inberg</title>
	<atom:link href="https://gerinberg.com/category/shiny/feed/" rel="self" type="application/rss+xml" />
	<link>https://gerinberg.com/category/shiny/</link>
	<description>data science developer</description>
	<lastBuildDate>Thu, 11 Aug 2022 18:09:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://gerinberg.com/wp-content/uploads/2017/05/favicon-150x150.jpg</url>
	<title>shiny Archives - Ger Inberg</title>
	<link>https://gerinberg.com/category/shiny/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Multi page shiny apps</title>
		<link>https://gerinberg.com/2022/08/11/multi-page-shiny-apps/</link>
		
		<dc:creator><![CDATA[Ger]]></dc:creator>
		<pubDate>Thu, 11 Aug 2022 18:09:05 +0000</pubDate>
				<category><![CDATA[data viz]]></category>
		<category><![CDATA[shiny]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[donation]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[R]]></category>
		<guid isPermaLink="false">https://gerinberg.com/?p=1834</guid>

					<description><![CDATA[<p>Web applications can have rich functionality nowadays. For example a website of an E-commerce shop has a page about the products they are selling, a page about their conditions, a shopping cart page and an order page. Furthermore it can handle different HTTP requests from [&#8230;]</p>
<p>The post <a href="https://gerinberg.com/2022/08/11/multi-page-shiny-apps/">Multi page shiny apps</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Web applications can have rich functionality nowadays. For example a website of an E-commerce shop has a page about the products they are selling, a page about their conditions, a shopping cart page and an order page. Furthermore it can handle different HTTP requests from the user. A GET request is used to retrieve a page (e.g. products) from the server whereas a POST request is used to send information to the server (e.g. make order).</p>
<h4>Problem</h4>
<p>Shiny apps are, by default, a bit limited when looking at it from this perspective.  It can handle only GET requests by default, unless you are a technical expert in this field, see <a href="https://stackoverflow.com/questions/25297489/accept-http-request-in-r-shiny-application" target="_blank" rel="noopener">this stack overflow</a> post. Furthermore shiny apps can have just one entry-point &#8220;/&#8221;. So you can&#8217;t have another entry-point &#8220;/page2&#8221;. Thus, the e-commerce shop is not possible out of the box in R shiny.</p>
<h4>Solution</h4>
<p>There are multiple solutions to support multiple pages. The one that I am using since a while is the package <a href="https://github.com/ColinFay/brochure" target="_blank" rel="noopener">brochure </a>developed by Colin Fay. It is still in development, so you might encounter some issues but I haven&#8217;t found any major bugs yet. A brochure app consists of a series of pages that are defined by an endpoint/path, a UI and a server function. Thus each page has its own shiny session, its own UI, and its own server! This is important to keep in mind.  A separate session for each page has some advantages but also some disadvantages (e.g. how to pass user data between pages?). A very simple brochureApp looks like this:</p>
<pre class="highlight"><code><span class="n">library(shiny)
library(brochure)

brochureApp</span><span class="p">(</span>
  <span class="c1"># First page</span>
  <span class="n">page</span><span class="p">(</span>
    <span class="n">href</span> <span class="o">=</span> <span class="s2">"/"</span><span class="p">,</span>
    <span class="n">ui</span> <span class="o">=</span> <span class="n">fluidPage</span><span class="p">(</span>
      <span class="n">h1</span><span class="p">(</span><span class="s2">"My first page"</span><span class="p">),</span> 
      <span class="n">plotOutput</span><span class="p">(</span><span class="s2">"plot"</span><span class="p">)</span>
    <span class="p">),</span>
    <span class="n">server</span> <span class="o">=</span> <span class="k">function</span><span class="p">(</span><span class="n">input</span><span class="p">,</span> <span class="n">output</span><span class="p">,</span> <span class="n">session</span><span class="p">){</span>
      <span class="n">output</span><span class="o">$</span><span class="n">plot</span> <span class="o">&lt;-</span> <span class="n">renderPlot</span><span class="p">({</span>
        <span class="n">plot</span><span class="p">(</span><span class="n">iris</span><span class="p">)</span>
      <span class="p">})</span>
    <span class="p">}</span>
  <span class="p">),</span> 
  <span class="c1"># Second page, no server-side function</span>
  <span class="n">page</span><span class="p">(</span>
    <span class="n">href</span> <span class="o">=</span> <span class="s2">"/page2"</span><span class="p">,</span> 
    <span class="n">ui</span> <span class="o">=</span>  <span class="n">fluidPage</span><span class="p">(</span>
      <span class="n">h1</span><span class="p">(</span><span class="s2">"My second page"</span><span class="p">)</span>
    <span class="p">)</span>
  <span class="p">)</span>
<span class="p">)</span></code></pre>
<h4>Donation app</h4>
<p>Coming back to the E-commerce shop example, I have developed an app where one can sponsor me for my open source work on R packages. The app has an integration with Stripe to make a donation and a thank you and error page. When calling Stripe you have to give the two endpoints for these pages and by using brochure, I am able to setup these endpoints. See the app on <a href="https://ginberg.shinyapps.io/donate/" target="_blank" rel="noopener">shinyapps.io</a> and of course I would appreciate it, if you use the app!:-)</p>
<p>The post <a href="https://gerinberg.com/2022/08/11/multi-page-shiny-apps/">Multi page shiny apps</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Corona-virus dashboard</title>
		<link>https://gerinberg.com/2020/02/18/corona-virus-dashboard/</link>
		
		<dc:creator><![CDATA[Ger]]></dc:creator>
		<pubDate>Tue, 18 Feb 2020 16:17:20 +0000</pubDate>
				<category><![CDATA[data viz]]></category>
		<category><![CDATA[shiny]]></category>
		<category><![CDATA[canvasXpress]]></category>
		<category><![CDATA[johnhopkins]]></category>
		<category><![CDATA[periscope]]></category>
		<category><![CDATA[r-shiny]]></category>
		<guid isPermaLink="false">https://gerinberg.com/?p=1404</guid>

					<description><![CDATA[<p>There is still quite some uncertainty about the corona-virus (Covid-19). Will it cause a pandemic? How deadly is it? Does it spread to other people easily? What is the length of the incubation period? It has already killed more people than SARS did. To answer [&#8230;]</p>
<p>The post <a href="https://gerinberg.com/2020/02/18/corona-virus-dashboard/">Corona-virus dashboard</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>There is still quite some uncertainty about the corona-virus (Covid-19). Will it cause a pandemic? How deadly is it? Does it spread to other people easily? What is the length of the incubation period?</p>
<p>It has already killed more people than <a href="https://www.nytimes.com/2020/02/09/world/asia/coronavirus-china.html#link-28cece0e" target="_blank" rel="noopener noreferrer">SARS</a> did. To answer the question about the growth of the corona-virus I made a dashboard. It displays the amount of people that:</p>
<ul>
<li>are confirmed to have the virus (Confirmed)</li>
<li>have recovered from it (Recovered)</li>
<li>have died because of it (Deaths)</li>
</ul>
<p>The first tab displays the number of people for those categories over time while the second tab displays the number of people per location. In the left sidebar, the total amount of Confirmed, Recovered and Deaths is shown. However, you can also filter by Country or Region.</p>
<p>Looking at the Confirmed cases, there is a huge spike around February 12th. This is caused by the fact that also patients that have symptoms but are not tested positive (yet) are added to the <a href="https://time.com/5783401/covid19-hubei-cases-classification/" target="_blank" rel="noopener noreferrer">reported cases</a>.</p>
<p>Around, 22 February, there&#8217;s a little spike because of new cases found in Italy and South Korea. Let&#8217;s hope the numbers are going down to zero soon!</p>
<p>View the <a href="https://shiny.gerinberg.com/coronavirus/" target="_blank" rel="noopener noreferrer">live dashboard</a></p>
<p><a href="https://gerinberg.com/wp-content/uploads/2020/02/corona_virus.png"><img decoding="async" class="alignnone size-medium wp-image-1410" src="https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-300x149.png" alt="" width="300" height="149" srcset="https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-300x149.png 300w, https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-1024x507.png 1024w, https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-768x381.png 768w, https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-1536x761.png 1536w, https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-830x411.png 830w, https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-230x114.png 230w, https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-350x173.png 350w, https://gerinberg.com/wp-content/uploads/2020/02/corona_virus-480x238.png 480w, https://gerinberg.com/wp-content/uploads/2020/02/corona_virus.png 1978w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>The post <a href="https://gerinberg.com/2020/02/18/corona-virus-dashboard/">Corona-virus dashboard</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Image recognition Shiny App using Keras</title>
		<link>https://gerinberg.com/2019/12/10/image-recognition-keras/</link>
					<comments>https://gerinberg.com/2019/12/10/image-recognition-keras/#comments</comments>
		
		<dc:creator><![CDATA[Ger]]></dc:creator>
		<pubDate>Tue, 10 Dec 2019 09:41:00 +0000</pubDate>
				<category><![CDATA[deep learning]]></category>
		<category><![CDATA[shiny]]></category>
		<category><![CDATA[image recognition]]></category>
		<category><![CDATA[keras]]></category>
		<guid isPermaLink="false">http://gerinberg.com/?p=1180</guid>

					<description><![CDATA[<p>Many people use the Python language to do Image recognition and other AI tasks. There has been a huge improvement lately in order to make some popular frameworks available in R. Of course, it&#8217;s possible to run Python code inside R (using reticulate) but it&#8217;s [&#8230;]</p>
<p>The post <a href="https://gerinberg.com/2019/12/10/image-recognition-keras/">Image recognition Shiny App using Keras</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Many people use the Python language to do Image recognition and other AI tasks. There has been a huge improvement lately in order to make some popular frameworks available in R. Of course, it&#8217;s possible to run Python code inside R (using <a href="https://github.com/rstudio/reticulate" target="_blank" rel="noreferrer noopener" aria-label="reticulate (opens in a new tab)">reticulate</a>) but it&#8217;s simpler to code in just one language. Keras is a popular framework which is build on top of Tensorflow. It is available in R package <em>keras</em> (<a rel="noreferrer noopener" aria-label="Rstudio documentation (opens in a new tab)" href="https://tensorflow.rstudio.com/keras/" target="_blank">Rstudio documentation</a>). this blog, I will show how I have build a Shiny application to recognize objects in an image.</p>



<h4 class="wp-block-heading" id="app">Shiny app</h4>



<p>The functionality of the application looks like this:</p>



<ol class="wp-block-list"><li>Upload an image to Shiny App</li><li>Perform image recognition using Keras</li><li>Plot detected objects in a Wordcloud and show scores in a table.</li></ol>



<p>I will explain more about task 2, since that is the main functionality. Keras has a number of pretrained models for image classification. They are trained on a large dataset called <a rel="noreferrer noopener" href="http://www.image-net.org/" target="_blank">ImageNet</a>.  I am using the RESNET 50 model since it&#8217;s simple to use. </p>



<h4 class="wp-block-heading">Resnet 50</h4>



<p>RESNET 50 is a <strong>Residual Network</strong> with 50 layers. As the name of the network indicates, this network uses residual learning. In general, in a deep convolutional neural network, several layers are stacked and are trained to the task at hand. The network learns several low/mid/high level features at the end of its layers. In residual learning, instead of trying to learn some features, we try to learn some residual. This residual can be simply understood as subtraction of feature learned from input of that layer. It has proved that training this form of networks is easier than training simple deep convolutional neural networks. Also the accuracy is better when adding more layers,compared to a standard neural network.</p>



<p>The steps needed to perform the image recognition:</p>



<ul class="wp-block-list"><li>Load the image into memory and convert the size to 224&#215;224, since that is the default size of RESNET 50.</li><li>Convert the image to a 3D array representation</li><li>Reshape the image array</li><li>Preprocess the image array</li><li>Predict the object &amp; scores using the RESNET 50 model</li><li>Decode the predictions to a data frame format</li></ul>



<p>The model performs quite good on average, the object with the highest score should be right in about 75% of all uploaded images. The performance of the RESNET 50 model and other models can be found on the <a rel="noreferrer noopener" aria-label="Keras website (opens in a new tab)" href="https://keras.io/applications/#resnet50" target="_blank">Keras website</a>.</p>



<p>Have a look at the application by clicking on the (animated) screenshot below or live at <a href="https://ginberg.shinyapps.io/image_recognition">shinyapps.io</a></p>



<div class="wp-block-envira-envira-gallery"><div class="envira-gallery-feed-output"><img decoding="async" class="envira-gallery-feed-image" src="https://gerinberg.com/wp-content/uploads/2018/12/image_recognition_app-1024x528-640x480.gif" title="image_recognition_app" alt="Image recognition" /></div></div>
<p>The post <a href="https://gerinberg.com/2019/12/10/image-recognition-keras/">Image recognition Shiny App using Keras</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://gerinberg.com/2019/12/10/image-recognition-keras/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Periscope Applications</title>
		<link>https://gerinberg.com/2019/01/26/periscope-applications/</link>
		
		<dc:creator><![CDATA[Ger]]></dc:creator>
		<pubDate>Sat, 26 Jan 2019 10:24:00 +0000</pubDate>
				<category><![CDATA[data viz]]></category>
		<category><![CDATA[shiny]]></category>
		<guid isPermaLink="false">https://gerinberg.com/?p=1345</guid>

					<description><![CDATA[<p>In one of my last blog posts I talked about Periscope which is a new R package to assist with creating shiny applications. We have been improving the package lately with a couple of items like support for row names in the DataTable module and a [&#8230;]</p>
<p>The post <a href="https://gerinberg.com/2019/01/26/periscope-applications/">Periscope Applications</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="font-family: georgia, palatino, serif;">In one of my last <a href="https://gerinberg.com/2019/03/06/interactive-gene-explorer/" target="_blank" rel="noopener noreferrer">blog posts</a> I talked about <a href="https://github.com/neuhausi/periscope" target="_blank" rel="noopener noreferrer">Periscope</a> which is a new R package to assist with creating shiny applications. </span>We have been improving the package lately with a couple of items like support for row names in the DataTable module and a gallery page with periscope apps. Feel free to add your awesome application to the <a href="https://gerinberg.com/periscope/" target="_blank" rel="noopener noreferrer">gallery page</a> as well! These are the current applications.</p>
<h5>Single Cell Viewer</h5>
<p>Thanks to technological advances made in the last few years, we are now able to study transcriptomes from thousands of single cells. These have been applied widely to study various aspects of Biology. Nevertheless, comprehending and inferring meaningful biological insights from these large datasets is still a challenge. Although tools are being developed to deal with the data complexity and data volume, we do not have yet an effective visualizations and comparative analysis tools to realize the full value of these datasets.</p>
<p>In order to address this gap, we implemented a single cell data visualization portal called Single Cell Viewer (SCV). SCV is an R shiny application that offers users rich visualization and exploratory data analysis options for single cell datasets.</p>
<p><a href="https://www.biorxiv.org/content/10.1101/664789v2" rel="nofollow">https://www.biorxiv.org/content/10.1101/664789v2</a></p>
<h5>Interactive Gene explorer</h5>
<p>IPF (Idiopathic Pulmonary Fibrosis) is a fatal disease that usually affects adults between the ages of 50-70. The disease is characterized by progressive decline in lung function resulting from scarring of lung tissue. With certain treatments, the disease progress might be stopped. In the dataset for the application, scientists have been looking at TGFb treatment and the results in gene expression.</p>
<p>The shiny application that has been developed can be used to gain insights from the research data.<br />
The dataset is divided into 9 contrasts, each containing (the same) 100 Genes. The first tab displays the Genes per contrasts and per gene the average gene expression, the (log) fold change and the P values. In the second tab, the treatment group vs the gene&#8217;s log2CPM value is shown. In the third tab, the data is displayed in a data table.</p>
<h5>Periscope sample application</h5>
<p>Sample shiny application demonstrating the functionality of the periscope framework. This is very useful if you are starting with the periscope package and want to explore the functionality.</p>
<p><a href="https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps.png"><img fetchpriority="high" decoding="async" class="size-medium wp-image-1349" src="https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps-300x170.png" alt="Periscope apps" width="300" height="170" srcset="https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps-300x170.png 300w, https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps-768x435.png 768w, https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps-1024x580.png 1024w, https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps-830x470.png 830w, https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps-230x130.png 230w, https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps-350x198.png 350w, https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps-480x272.png 480w, https://gerinberg.com/wp-content/uploads/2019/08/periscope_apps.png 1194w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>The post <a href="https://gerinberg.com/2019/01/26/periscope-applications/">Periscope Applications</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Asynchronous download in Shiny</title>
		<link>https://gerinberg.com/2018/12/11/asynchronous-download-shiny/</link>
		
		<dc:creator><![CDATA[Ger]]></dc:creator>
		<pubDate>Tue, 11 Dec 2018 02:21:37 +0000</pubDate>
				<category><![CDATA[data viz]]></category>
		<category><![CDATA[shiny]]></category>
		<guid isPermaLink="false">http://gerinberg.com/?p=1105</guid>

					<description><![CDATA[<p>Since the release of Shiny 1.1.0, we have the option to use asynchronous operations. I will describe why and how I have implemented an asynchronous download. Problem R is single threaded by nature. You can install R on a powerful server with 64 CPU cores, but [&#8230;]</p>
<p>The post <a href="https://gerinberg.com/2018/12/11/asynchronous-download-shiny/">Asynchronous download in Shiny</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Since the release of <a href="https://blog.rstudio.com/2018/06/26/shiny-1-1-0/" target="_blank" rel="noopener">Shiny 1.1.0</a>, we have the option to use asynchronous operations. I will describe why and how I have implemented an asynchronous download.</p>
<h5>Problem</h5>
<p>R is single threaded by nature. You can install R on a powerful server with 64 CPU cores, but R will only use one of them by default. This can make it challenging to get a good performance of your script cq application.</p>
<p>For a client, I have created a PDF report from their shiny app. Since there are many plots and datatables in the application, the report is quite big. It can take about a minute on shinyapps.io. Time in which another user possibly cannot access the dashboard.  This depends on your deployment configuration and the current amount of users that are connected to your dashboard.</p>
<h5>Solution</h5>
<p>To overcome this issue, I have rewritten my report generation code in a way that it&#8217;s performed asynchronously.  To accomplish this I have used the following libraries:</p>
<ul>
<li><strong>future</strong>: used to perform the long running report operation in a worker process that runs in the background, leaving the (main) Shiny processes free to serve other users in the meantime.</li>
<li><strong>promises</strong>: to handle the result of the long running report operation back in the Shiny process, where we can display the result (downloaded files) back to the user.</li>
<li><strong>ipc</strong>: used to display an (Async compatible) progress bar.</li>
</ul>
<h5>Testing</h5>
<p>To test that it works, open the shiny app (see link below) in 2 browser tabs. When you click on &#8216;Download Report&#8217; in the 1st tab, you still should be able to use the application in the 2nd tab.</p>
<p>You can view the app including <strong>source code</strong> on my <a href="https://ginberg.shinyapps.io/async_download/" target="_blank" rel="noopener">Shinyapps.io</a></p>
<p> </p>
<p> </p>
<p> </p>


<div class="wp-block-envira-envira-gallery"><div class="envira-gallery-feed-output"><img decoding="async" class="envira-gallery-feed-image" src="https://gerinberg.com/wp-content/uploads/2018/12/async_download-1-1024x532-640x480.png" title="Asynchronous download" alt="Asynchronous download" /></div></div>
<p>The post <a href="https://gerinberg.com/2018/12/11/asynchronous-download-shiny/">Asynchronous download in Shiny</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>RStudio Connect installation</title>
		<link>https://gerinberg.com/2018/10/20/rstudio-connect-installation/</link>
		
		<dc:creator><![CDATA[Ger]]></dc:creator>
		<pubDate>Sat, 20 Oct 2018 07:02:12 +0000</pubDate>
				<category><![CDATA[data viz]]></category>
		<category><![CDATA[shiny]]></category>
		<guid isPermaLink="false">http://gerinberg.com/?p=1126</guid>

					<description><![CDATA[<p>RStudio Connect (RSC) is a relatively new platform of RStudio. It is a place where you can share your Shiny applications, R Markdown reports, Plumber APIs, plots and more with your team and your users. It uses the push-button functionality from your local RStudio to deploy [&#8230;]</p>
<p>The post <a href="https://gerinberg.com/2018/10/20/rstudio-connect-installation/">RStudio Connect installation</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>RStudio Connect (RSC) is a relatively new platform of RStudio. It is a place where you can share your Shiny applications, R Markdown reports, Plumber APIs, plots and more with your team and your users. It uses the push-button functionality from your local RStudio to deploy your artefacts to RSC.  This works just like using Shinyapps.io, but that platform can only be used to share Shiny apps. In this post I will tell you how I have installed RSC on AWS.</p>
<p><em>Note: you can try RStudio Connect 45 days for free, after that you will need to buy a license.</em></p>
<h4>Installation</h4>
<p>I am working primarily with Ubuntu, so I have  installed RSC on Ubuntu 18.  You can also install it on other Linux distributions such as Redhat or Suse. In order to install RSC root privileges are required and (of course) R need to be installed. So, let&#8217;s start with that.</p>
<h5>Install R</h5>
<ol>
<li>Install the packages needed to add a new repository over HTTPS:
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">sudo apt install apt-transport-https software-properties-common</span></code></pre>
</div>
</li>
<li>Enable the CRAN repository and add the CRAN GPG key to your system:
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
</span><span class="line">sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'</span></code></pre>
</div>
</li>
<li>Now that the repository is added, update the packages list and install the R package:
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">sudo apt update
</span><span class="line">sudo apt install r-base</span></code></pre>
</div>
</li>
<li>To verify that R is installed successfully, run the following command, it prints the R version:
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">R --version
</span></code></pre>
</div>
</li>
</ol>
<p> </p>
<h5>Install RSC</h5>
<p>Now that R is installed, let&#8217;s proceed with RSC. The latest version, at the moment of this blog creation is 1.6.10, but please check the <a href="https://www.rstudio.com/products/connect/download-commercial/">RStudio site</a> for the latest release.</p>
<div class="highlight">
<pre class="chroma console-bash"><code><code style="white-space: pre-wrap;">sudo apt-get install gdebi-core</code> <br />wget https://s3.amazonaws.com/rstudio-connect/rstudio-connect_1.6.10-3_amd64.deb</code> <br /><code>sudo gdebi rstudio-connect_1.6.10-3_amd64.deb</code><code class="language-console-bash" data-lang="console-bash">
</code></pre>
</div>
<p> </p>
<h5>Configuration</h5>
<p>Two things need to be configured as a bare minimum.  These are the Server email address and the Server hostname. The configuration can be found at <strong>/etc/rstudio-connect/rstudio-connect.gcfg. </strong>Open the file and look for the &#8220;Server&#8221; section. They are empty by default.  The <em>SenderEmail</em> is the address that you will see, when RSC sends an email to you. The <em>address</em> is the public URL used to access the server. When accessible over a non-standard port (e.g. not 80), this URL must contain both hostname and port!</p>
<div class="highlight">
<pre class="chroma console-bash"><code class="language-console-bash" data-lang="console-bash"><span class="line">[Server] 
SenderEmail = rstudio-connect@company.com 
Address = https://rstudio-connect.company.com/</span></code></pre>
</div>
<p>After setting these properties, restart the RSC process:</p>
<div class="highlight">
<pre class="chroma console-bash"><code class="sourceCode bash"><span class="fu">sudo systemctl restart rstudio-connect<br /></span></code></pre>
</div>
<p> </p>
<h5>Testing</h5>
<p>RSC should be up and running now, so it&#8217;s time to test it with an actual deployment.  From RStudio, I am deploying a Shiny app through the push-button. This blue button is located on the top right side of the source window when you are editing a Shiny source file (e.g. server.R, ui.R or app.R). First, choose the option &#8216;Manage accounts&#8217; to setup a connection to your RSC. It will start a popup where you have to fill in the RSC URL, so that you can give it permission to install applications. Next, choose the &#8216;Publish Application&#8217; option. In the popup that opens, choose a name and select the files needed by your application.  Click &#8216;Publish&#8217; and your first app is going to be deployed on RSC. The first time to deploy a new application can take quite a while, since it probably needs to install some libraries.</p>
<p> </p>


<div class="wp-block-envira-envira-gallery"><div class="envira-gallery-feed-output"><img decoding="async" class="envira-gallery-feed-image" src="https://gerinberg.com/wp-content/uploads/2018/12/rsconnect1-1024x623-640x480.png" title="Manage accounts" alt="Manage accounts" /></div></div>
<p>The post <a href="https://gerinberg.com/2018/10/20/rstudio-connect-installation/">RStudio Connect installation</a> appeared first on <a href="https://gerinberg.com">Ger Inberg</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
