<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/shiny-data-presentation-with-an-extra/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=http%3A%2F%2Fr-posts.com%2Fshiny-data-presentation-with-an-extra%2F"> R-posts.com</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h3><a target="_blank" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fshiny.rstudio.com%2F">
<figure class="wp-caption"><img sizes="(max-width: 660px) 100vw, 660px" data-image-description="" data-orig-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/Shiny-1.png?fit=2482%2C1018" data-orig-size="2482,1018" data-image-title="Shiny" data-comments-opened="1" class="wp-image-166" data-recalc-dims="1" data-attachment-id="166" data-permalink="http://r-posts.com/shiny-data-presentation-with-an-extra/shiny-2/" alt="" data-medium-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/Shiny-1.png?fit=450%2C185" data-large-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/Shiny-1.png?fit=450%2C185" data-image-meta="{" src="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/Shiny-1.png?resize=660%2C272"><br>
<figcaption class="wp-caption-text"><span>A Shiny app with three tabs presenting different sections of the same data.</span></figcaption>
</figure>
<p><strong><span>Shiny</span></strong><span><strong> </strong>is an application based on R/RStudio which enables an interactive exploration of data through a dashboard with drop-down lists and checkboxes—programming-free. The apps can be useful for both the data analyst and the public.</span></a>
<p>Shiny apps are <strong>based on the Internet</strong>: This allows for private consultation of the data on one’s own browser as well as for online publication. Free apps can handle quite a lot of data, which can be increased with a subscription.</p>
<p> <img sizes="(max-width: 270px) 100vw, 270px" data-image-description="" data-orig-file="https://i0.wp.com/r-posts.com/wp-content/uploads/2017/05/repository.png?fit=1094%2C1157" data-orig-size="1094,1157" data-image-title="repository" data-comments-opened="1" class="wp-image-163" data-recalc-dims="1" data-attachment-id="163" data-permalink="http://r-posts.com/shiny-data-presentation-with-an-extra/repository/" alt="" data-medium-file="https://i0.wp.com/r-posts.com/wp-content/uploads/2017/05/repository.png?fit=284%2C300" data-large-file="https://i0.wp.com/r-posts.com/wp-content/uploads/2017/05/repository.png?fit=450%2C476" data-image-meta="{" src="https://i0.wp.com/r-posts.com/wp-content/uploads/2017/05/repository.png?resize=270%2C285">The <a target="_blank" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fshiny.rstudio.com%2Fgallery%2F">target user of Shiny is extremely broad</a>. Let’s take science—<strong>open science</strong>. At a time when openly archiving all data is becoming standard practice (e.g., OSF.io, Figshare.com, Github.com), Shiny can be used to walk the extra mile by letting people tour the data at once without programming. It’s the right tool for acknowledging all aspects of the data. Needless to say, these <strong>apps do not replace raw data </strong>archiving.</p>
<p> The apps simply add. For instance, the data in the lower app is a little noisy, right? Indeed it shows none of the succession of waves that characterizes word reading. The app helped me in identifying this issue. Instead of running along a host of participants and electrodes through a heavy code score, I found that the drop-down lists of the app let me seamlessly surf the data. By Participant 7, though, my wave dropped me…<br>
<span> </span><br>
<img sizes="(max-width: 629px) 100vw, 629px" data-image-description="" data-orig-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/noisy-waves.png?fit=2524%2C2113" data-orig-size="2524,2113" data-image-title="noisy waves" data-comments-opened="1" class="wp-image-164" data-recalc-dims="1" data-attachment-id="164" data-permalink="http://r-posts.com/shiny-data-presentation-with-an-extra/noisy-waves/" alt="" data-medium-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/noisy-waves.png?fit=358%2C300" data-large-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/noisy-waves.png?fit=450%2C377" data-image-meta="{" src="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/noisy-waves.png?resize=629%2C527"><span><br>
Those data were very poor—systematically poorer than those of any other participants. I then checked the EEG preprocessing logs, and confirmed that those data had to be discarded. So much for the analysis utility of such an app. On the open science utility, what I did on discovering the fault was maintain the discarded data in the app, with a note, so that any colleagues and reviewers could consider it too. Now, although this example of use concerns a rather salient trait in the data, some other Shiny app might help to spot patterns such as individual differences, third variables.
<p> <img sizes="(max-width: 404px) 100vw, 404px" data-image-description="" data-orig-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/files.png?fit=780%2C288" data-orig-size="780,288" data-image-title="files" data-comments-opened="1" class="wp-image-165" data-recalc-dims="1" data-attachment-id="165" data-permalink="http://r-posts.com/shiny-data-presentation-with-an-extra/files/" alt="" data-medium-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/files.png?fit=450%2C166" data-large-file="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/files.png?fit=450%2C166" data-image-meta="{" src="https://i2.wp.com/r-posts.com/wp-content/uploads/2017/05/files.png?resize=404%2C149">Building a Shiny app is <strong>not difficult.</strong> Apps basically draw on some data presentation code (tables, plots) that you already have. Then just add a couple of scripts into the folder: one for the user interface (named iu.R), one for the process (named server.R), and perhaps another one compiling the commands for deploying the app and checking any errors.<br>
</p></span>
<h3>The steps to start a Shiny app from scratch are:</h3>
<p><strong>1: Tutorials.</strong><em> </em>Being open-source software, the best manuals are available through a Google search.</p>
<p> <strong>2: User token. </strong>Signing up and reading in your private key—just once.</p>
<p> <strong>3: GO. </strong>Plunge into the ui and server scripts, and deployApp().</p>
<p> <strong>4: Bugs and logs.</strong> They are not bugs in fact—rather fancies. For instance, some special characters have to get even more special (technically, UTF-8 encoding). For a character such as μ, Shiny prefers Âμ. Just cling to error logs by calling:</p>
<pre>
showLogs(appPath = getwd(), appFile = NULL, appName = NULL, account = NULL, entries = 50, streaming = FALSE) 
</pre>
<p> The log output will mention any typos and unaccepted characters, pointing to specific lines in your code.</p>
<p> It may take a couple of intense days to get a first app running. As usual with programming, it’s easy to run into the traps which are there to spice up the way. The app’s been around for years, so tips and tricks abound on the Internet. For greater companionship, there are <strong>dedicated Google groups, </strong>and then there’s <strong>StackExchange </strong>etc., where you can post any needs/despair. Post your code, log, and explanation, and you’ll be rescued out in a couple of days. Long live those contributors.</p>
<p> It will often be enough to upload a bare app, but you might then think it can look better.<br>
<strong><br>
5 (optional): Pro up.</strong> Use tabs to <strong>combine multiple apps in one</strong>, use different <strong>widgets</strong>, etc. Tutorials like <a target="_blank" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQ9sRKkaNveI">this one on Youtube</a> can take you there, especially those that provide the code, as in the description of that video. <strong>Use those scripts as templates. </strong>For example, see <a target="_blank" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fosf.io%2Ft93xf%2F">this script</a> in which the function conditionalPanel() is used to modify the app’s sidebar based on which tab is selected. The utility of tabs is illustrated in the upper cover of this article and in the app shown in the text: When having multiple data sections, the tabs allow you to have all in one (cover screenshot), instead of linking to other apps in each (screenshot in text).</p>
<p> Time for logistics. You can <strong>include any text</strong> in your app’s webpage, such as explanations of any length, web links, and author information. Oh, also importantly: the Shiny application allows for the presentation of data in any of the forms available in R—notably, plots and tables. Costs: Shiny is <strong>free to use,</strong> in principle. You may only have to pay if you use your app(s) a lot—first month, commonly—, in which case you may pay 9 euros a month. There are different <a target="_blank" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=http%3A%2F%2Fwww.shinyapps.io%2F%23_pricing">subscription plans</a>. The free plan allows 25 hours of use per month, distributed among up to five apps.</p>
<p> There do exist <strong>alternatives</strong> to Shiny. One is fairly similar: It’s called Tableau. A <a target="_blank" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fwww.linkedin.com%2Fpulse%2Fr-shiny-v-tableau-dawn-graphics-anand-gupta">nice comparison of the two apps is available here</a>. Then, there’s a more advanced application called <a target="_blank" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fd3js.org%2F">D3.js</a>, which allows for lush graphics but proves more restrictive to newbies.</p>
<p> In sum, if you already program in R or even in Python, but have not tried online data presentation yet, consider it.</p>
<p> Feel free to share your ideas, experiences, or doubts in a comment on the <a target="_blank" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fwww.linkedin.com%2Fpulse%2Fshiny-data-presentation-added-value-pablo-bernabeu">original post</a>.</p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=http%3A%2F%2Fr-posts.com%2Fshiny-data-presentation-with-an-extra%2F"> R-posts.com</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Ffeedburner.google.com%2Ffb%2Fa%2Fmailverify%3Furi%3DRBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fwww.r-project.org%2F">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://apicdn.viglink.com/api/click?format=go&key=949efb41171ac6ec1bf7f206d57e90b8&loc=https%3A%2F%2Fwww.r-bloggers.com%2Ffeed%2F&out=https%3A%2F%2Fwww.r-users.com%2F">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/pl8rGSBIDxM"></a></div></h3>