mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
hello shiny tutorial
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
body {
|
||||
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
||||
}
|
||||
.responsive-image {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
|
||||
|
||||
@@ -21,6 +24,10 @@
|
||||
|
||||
<!-- Styles for R syntax highlighter -->
|
||||
<style type="text/css">
|
||||
tt, code, pre {
|
||||
font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace;
|
||||
}
|
||||
|
||||
pre .operator,
|
||||
pre .paren {
|
||||
color: rgb(104, 118, 135)
|
||||
@@ -80,10 +87,10 @@ hljs.initHighlightingOnLoad();
|
||||
<div class="span4 well">
|
||||
<ul class = "nav nav-list">
|
||||
<li class="nav-header">Getting Started</li>
|
||||
<li class="active">
|
||||
<li class="">
|
||||
<a href="#installation">Installation</a>
|
||||
</li>
|
||||
<li>
|
||||
<li class="active">
|
||||
<a href="#hello">Hello Shiny</a>
|
||||
</li>
|
||||
<li>
|
||||
@@ -124,8 +131,9 @@ hljs.initHighlightingOnLoad();
|
||||
</div>
|
||||
|
||||
<div class="span8 tab-content">
|
||||
<div class="tab-pane active" id="installation">
|
||||
|
||||
<div class="tab-pane" id="installation">
|
||||
|
||||
|
||||
<p>You can install shiny directly from github using the <code>devtools</code> package. In order to install shiny you'll also need to be configured to build R packages from source. To install devtools and verify that you can build packages from source:</p>
|
||||
|
||||
<pre><code class="r">install.packages("devtools")
|
||||
@@ -170,8 +178,74 @@ runExample("01_hello")
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="hello">
|
||||
Hello
|
||||
<div class="tab-pane active" id="hello">
|
||||
|
||||
<h4>Screenshot</h4>
|
||||
|
||||
<img src="screenshots/hello.png" class="responsive-image"></img>
|
||||
|
||||
|
||||
<h4>Run the example</h4>
|
||||
|
||||
<pre><code class="r">library(shiny)
|
||||
runExample("hello")
|
||||
</code></pre>
|
||||
|
||||
<h4>ui.R</h4>
|
||||
|
||||
<pre><code class="r">library(shiny)
|
||||
|
||||
shinyUI(
|
||||
pageWithSidebar(
|
||||
|
||||
headerPanel(
|
||||
h1("Hello shiny!")
|
||||
),
|
||||
|
||||
sidebarPanel(
|
||||
numericInput("obs",
|
||||
"Number of observations:",
|
||||
min = 0,
|
||||
max = 10000,
|
||||
value = 500)
|
||||
),
|
||||
|
||||
mainPanel(
|
||||
plotOutput("plot")
|
||||
)
|
||||
)
|
||||
)
|
||||
</code></pre>
|
||||
|
||||
<h4>server.R</h4>
|
||||
|
||||
<pre><code class="r">library(shiny)
|
||||
|
||||
shinyServer(function(input, output) {
|
||||
|
||||
output$plot <- reactivePlot(function() {
|
||||
|
||||
obs <- as.integer(input$obs)
|
||||
|
||||
hist(rnorm(obs))
|
||||
})
|
||||
|
||||
})
|
||||
</code></pre>
|
||||
|
||||
|
||||
<ul class="pager">
|
||||
<li>
|
||||
<a href="#">← Previous</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">Next →</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
BIN
tutorial/screenshots/hello.png
Normal file
BIN
tutorial/screenshots/hello.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Reference in New Issue
Block a user