Minor punctuation, wording, formatting changes

This commit is contained in:
Joe Cheng
2012-07-29 11:07:12 -07:00
parent c5254797eb
commit 16c236d63f
3 changed files with 28 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
![Hello Shiny Screenshot](screenshots/hello-shiny.png)
The Hello Shiny example is a simple application that generates a random distribution with a configurable number of observations and then plots it. To run the example type:
The Hello Shiny example is a simple application that generates a random distribution with a configurable number of observations and then plots it. To run the example, type:
<pre><code class="console">&gt; library(shiny)
&gt; runExample(&quot;01_hello&quot;)
@@ -9,7 +9,7 @@ The Hello Shiny example is a simple application that generates a random distribu
Shiny applications have two components: a user-interface definition and a server script. The source code for both of these components is listed below.
In subsequent sections of the tutorial we'll break down all of the code in detail and explain the use of "reactive" functions for generating output. For starters though just try playing with the sample application and reviewing the source code to get an initial feel for things. Be sure to read the comments carefully as they explain in detail what the code is doing and why.
In subsequent sections of the tutorial we'll break down all of the code in detail and explain the use of "reactive" functions for generating output. For now, though, just try playing with the sample application and reviewing the source code to get an initial feel for things. Be sure to read the comments carefully.
The user interface is defined in a source file named ui.R:
@@ -39,7 +39,7 @@ shinyUI(pageWithSidebar(
))
</code></pre>
The server-side of the application is shown below. At one level it's very simple--a random distribution with the requested number of observations is generated and then plotted as a historgram. However, you'll also notice that the function which returns the plot is wrapped in a call to `reactivePlot`. The comment above the function explains a bit about this, but if you find it confusing don't worry we'll cover this concept in much more detail soon.
The server-side of the application is shown below. At one level, it's very simple--a random distribution with the requested number of observations is generated, and then plotted as a historgram. However, you'll also notice that the function which returns the plot is wrapped in a call to `reactivePlot`. The comment above the function explains a bit about this, but if you find it confusing, don't worry--we'll cover this concept in much more detail soon.
#### server.R
@@ -64,4 +64,4 @@ shinyServer(function(input, output) {
})
</code></pre>
The next example will show the use of more input controls as well as the use of reactive functions to generate textual output.
The next example will show the use of more input controls, as well as the use of reactive functions to generate textual output.

View File

@@ -1,7 +1,7 @@
![Tabsets Screenshot](screenshots/shiny-text.png)
The Shiny Text application demonstrates printing R objects directly as well as displaying data-frames using HTML tables. To run the example type:
The Shiny Text application demonstrates printing R objects directly, as well as displaying data frames using HTML tables. To run the example, type:
<pre><code class="console">&gt; library(shiny)
&gt; runExample(&quot;02_text&quot;)
@@ -9,9 +9,9 @@ The Shiny Text application demonstrates printing R objects directly as well as d
The first example had a single numeric input specified using a slider and a single plot output. This example has a bit more going on: two inputs and two types of textual output.
If you try changing the number of observations to another value you'll see a demonstration of one of the most important attributes of Shiny applications -- inputs and outputs are connected together "live" and changes are propagated immediately (like a spreadsheet). In this case rather than the entire page being reloaded just the table view is updated when the number of observations change.
If you try changing the number of observations to another value, you'll see a demonstration of one of the most important attributes of Shiny applications: inputs and outputs are connected together "live" and changes are propagated immediately (like a spreadsheet). In this case, rather than the entire page being reloaded, just the table view is updated when the number of observations change.
Here is the user interface definition for the application. Notice in particular that the `sidebarPanel` and `mainPanel` functions now take two arguments (corresponding to the two inputs and two outputs displayed):
Here is the user interface definition for the application. Notice in particular that the `sidebarPanel` and `mainPanel` functions are now called with two arguments (corresponding to the two inputs and two outputs displayed):
#### ui.R
@@ -42,7 +42,10 @@ shinyUI(pageWithSidebar(
))
</code></pre>
The server side of the application has also gotten a bit more complicated. Now rather than just computing a single output we see the definition of a reactive function to return the dataset corresponding to the user choice and two other reactive functions (`reactivePrint` and `reactiveTable`) that return the output$summary and output$view values.
The server side of the application has also gotten a bit more complicated. Now we create:
* A reactive function to return the dataset corresponding to the user choice
* Two other reactive functions (`reactivePrint` and `reactiveTable`) that return the output$summary and output$view values
These reactive functions work similarly to the `reactivePlot` function used in the first example: by declaring a reactive function you tell Shiny that it should only be executed when it's dependencies change. In this case that's either one of the user input values (input$dataset or input$n)

View File

@@ -1,27 +1,30 @@
## Introducing Shiny
# Introducing Shiny
Shiny is a new package from RStudio that makes it incredibly easy to build interactive web applications with R.
Shiny is a new package from RStudio that makes it incredibly easy to build interactive web applications with R. Building applications with Shiny has many compelling benefits, including:
### Features
* Automatic [reactive](http://en.wikipedia.org/wiki/Reactive_programming) data-binding between inputs and outputs that makes it possible to build useful applications with only a few lines of code.
* Shiny user-interfaces are "live" in the same way that spreadsheets are live. Outputs change instantly as users modify inputs without explicit programming or requiring a reload of the browser.
* Applications can be built entirely using R, or can optionally make use of custom HTML, CSS, and JavaScript.
* A highly customizable slider control that has built-in support for animation.
* Build useful applications with only a few lines of code--no JavaScript required.
* Shiny applications are automatically "live" in the same way that spreadsheets are live. Outputs change instantly as users modify inputs, without requiring a reload of the browser.
* Shiny user interfaces can be built entirely using R, or can be written directly in HTML, CSS, and JavaScript for more flexibility.
* Attractive default UI theme based on [Twitter Bootstrap](http://twitter.github.com/bootstrap).
* A highly customizable slider widget with built-in support for animation.
* Pre-built output widgets for displaying plots, tables, and printed output of R objects.
* Fast bi-directional communication between the web browser and R using the [websockets](http://illposed.net/websockets.html) package.
* Fast bidirectional communication between the web browser and R using the [websockets](http://illposed.net/websockets.html) package.
* Uses a [reactive](http://en.wikipedia.org/wiki/Reactive_programming) programming model that eliminates messy event handling code, so you can focus on the code that really matters.
* Develop and redistribute your own Shiny widgets that other developers can easily drop into their own applications (coming soon!).
#### Getting Started
### Getting Started
If you've already got the Shiny package installed you are ready to go. If you don't have Shiny yet you'll need to:
If you've already got the Shiny package installed, you're ready to go. If you don't have Shiny yet, you'll need to:
* Request access to the beta at [http://shiny.rstudio.org](http://shiny.rstudio.org)
* Once you have been granted access to the beta download and install the Shiny package from GitHub at
* Request access to the beta at [http://shiny.rstudio.org](http://shiny.rstudio.org).
* Once you have been granted access to the beta, download and install the Shiny package from GitHub at
[https://github.com/rstudio/shiny](https://github.com/rstudio/shiny).
#### Let's Go
This tutorial covers the basics of Shiny and provides detailed examples of using nearly all of its capabilities. Click the Next button to get started and say hello to Shiny!
### Let's Go!
This tutorial covers the basics of Shiny and provides detailed examples of using much of its capabilities. Click the Next button to get started and say hello to Shiny!