{"id":402,"date":"2013-12-27T13:03:36","date_gmt":"2013-12-27T18:03:36","guid":{"rendered":"http:\/\/homepages.uc.edu\/~yaozo\/wordpress\/?p=402"},"modified":"2013-12-27T13:03:36","modified_gmt":"2013-12-27T18:03:36","slug":"introducing-shiny-easy-web-applications-in-r","status":"publish","type":"post","link":"https:\/\/zhuoyao.net\/index.php\/2013\/12\/27\/introducing-shiny-easy-web-applications-in-r\/","title":{"rendered":"Introducing Shiny Easy web applications in R"},"content":{"rendered":"<div>\n<div>\n<h1>Easy web applications in R<\/h1>\n<div>\n<p><strong>Shiny makes it super simple for R users like you to turn analyses into interactive web applications that anyone can use.<\/strong>\u00a0Let your users choose input parameters using friendly controls like sliders, drop-downs, and text fields. Easily incorporate any number of outputs like plots, tables, and summaries.<\/p>\n<p>No HTML or JavaScript knowledge is necessary. If you have some experience with R, you\u2019re just minutes away from combining the statistical power of R with the simplicity of a web page.<\/p>\n<\/div>\n<h3>Shiny in action<\/h3>\n<p>Here\u2019s a basic Shiny application, consisting of less than 40 lines of code.<br \/>\nTry changing the number of bins and toggling the checkboxes.<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\n<div id=\"example1-container\"><iframe loading=\"lazy\" id=\"example1\" src=\"http:\/\/glimmer.rstudio.com\/rstudio\/faithful\/\" height=\"240\" width=\"320\"><\/iframe><\/div>\n<\/div>\n<div>\n<ul>\n<li><a href=\"http:\/\/www.rstudio.com\/shiny\/#code-ui\" data-toggle=\"tab\">ui.R<\/a><\/li>\n<li><a href=\"http:\/\/www.rstudio.com\/shiny\/#code-server\" data-toggle=\"tab\">server.R<\/a><\/li>\n<\/ul>\n<div id=\"example1-code\">\n<div id=\"code-ui\">\n<pre><code>shinyUI(bootstrapPage(\n\n  selectInput(inputId = \"n_breaks\",\n      label = \"Number of bins in histogram (approximate):\",\n      choices = c(10, 20, 35, 50),\n      selected = 20),\n\n  checkboxInput(inputId = \"individual_obs\",\n      label = strong(\"Show individual observations\"),\n      value = FALSE),\n\n  checkboxInput(inputId = \"density\",\n      label = strong(\"Show density estimate\"),\n      value = FALSE),\n\n  plotOutput(outputId = \"main_plot\", height = \"300px\"),\n\n  # Display this only if the density is shown\n  conditionalPanel(condition = \"input.density == true\",\n    sliderInput(inputId = \"bw_adjust\",\n        label = \"Bandwidth adjustment:\",\n        min = 0.2, max = 2, value = 1, step = 0.2)\n  )\n\n))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>Please see our\u00a0<a href=\"http:\/\/rstudio.github.com\/shiny\/tutorial\/\">tutorial<\/a>\u00a0to learn more about writing Shiny apps.<\/p>\n<\/div>\n<\/div>\n<div>\n<div>\n<h3>More examples<\/h3>\n<p>Check out more Shiny examples in our\u00a0<a href=\"http:\/\/www.rstudio.com\/shiny\/showcase\/\">showcase<\/a>.<\/p>\n<h3>Getting started<\/h3>\n<p>First, install the\u00a0<tt>shiny<\/tt>\u00a0package by executing this command at your R console:<\/p>\n<pre><code>install.packages('shiny')\n<\/code><\/pre>\n<p>Then take a look at our\u00a0<a href=\"http:\/\/rstudio.github.com\/shiny\/tutorial\/\">tutorial<\/a>, which will take you on a step-by-step tour through Shiny. (There\u2019s also documentation in the R package, but we highly recommend you go through most of the tutorial before diving into the function-level documentation.)<\/p>\n<h3>Deploying Shiny apps<\/h3>\n<p>The Shiny package itself is designed to run Shiny applications locally. To share Shiny applications with other R users, you can send them your application source as a GitHub gist, R package, or zip file (see\u00a0<a href=\"http:\/\/rstudio.github.com\/shiny\/tutorial\/#deployment\">details<\/a>).<\/p>\n<p>You can also deploy Shiny applications over the web, so that users need only a web browser and your application\u2019s URL. You\u2019ll need a Linux server and our\u00a0<a href=\"http:\/\/www.rstudio.com\/shiny\/server\/\">Shiny Server<\/a>\u00a0software, which comes in open source and commercial editions.<\/p>\n<p>If you want to deploy over the web but prefer not to run your own server, we have an open trial of ShinyApps, our subscription-based hosting service for Shiny. To apply for a free beta test account on our hosting service,\u00a0<a href=\"http:\/\/www.shinyapps.io\/signup.html\">register now<\/a>.<\/p>\n<h3>Get involved<\/h3>\n<p>Join\u00a0<a href=\"http:\/\/groups.google.com\/group\/shiny-discuss\">shiny-discuss<\/a>\u00a0and let us know if you have any questions\/comments, or just want to show off your latest Shiny app!<\/p>\n<p>You can also visit our\u00a0<a href=\"https:\/\/github.com\/rstudio\/shiny\">GitHub repository<\/a>\u00a0to get access to the source code and issues database.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Easy web applications in R Shiny makes it super simple for R users like you to turn analyses into interactive web applications that anyone can&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-402","post","type-post","status-publish","format-standard","hentry","category-r"],"_links":{"self":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/comments?post=402"}],"version-history":[{"count":0,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/402\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/media?parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/categories?post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/tags?post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}