mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-06 20:55:24 -05:00
Drop 'shiny' from func names; layout changes
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
library(digest)
|
||||
|
||||
input <- Observable$new(function() {
|
||||
str <- get.shiny.input('input1')
|
||||
if (get.shiny.input('addnewline'))
|
||||
str <- get.input('input1')
|
||||
if (get.input('addnewline'))
|
||||
str <- paste(str, "\n", sep='')
|
||||
return(str)
|
||||
})
|
||||
|
||||
define.shiny.output('md5_hash', function() {
|
||||
define.output('md5_hash', function() {
|
||||
digest(input$get.value(), algo='md5', serialize=F)
|
||||
})
|
||||
define.shiny.output('sha1_hash', function() {
|
||||
define.output('sha1_hash', function() {
|
||||
digest(input$get.value(), algo='sha1', serialize=F)
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
data <- Observable$new(function() {
|
||||
# Choose a distribution function
|
||||
dist <- switch(get.shiny.input('dist'),
|
||||
dist <- switch(get.input('dist'),
|
||||
norm = rnorm,
|
||||
unif = runif,
|
||||
lnorm = rlnorm,
|
||||
@@ -8,21 +8,21 @@ data <- Observable$new(function() {
|
||||
rnorm)
|
||||
|
||||
# Generate n values from the distribution function
|
||||
dist(max(1, get.shiny.input('n')))
|
||||
dist(max(1, get.input('n')))
|
||||
})
|
||||
|
||||
define.shiny.plot('plot1', function() {
|
||||
dist <- get.shiny.input('dist')
|
||||
n <- get.shiny.input('n')
|
||||
define.plot('plot1', function() {
|
||||
dist <- get.input('dist')
|
||||
n <- get.input('n')
|
||||
|
||||
hist(data$get.value(),
|
||||
main=paste('r', dist, '(', n, ')', sep=''))
|
||||
}, width=600, height=300)
|
||||
|
||||
define.shiny.table('table1', function() {
|
||||
define.table('table1', function() {
|
||||
data.frame(x=data$get.value())
|
||||
})
|
||||
|
||||
define.shiny.output('summary1', function() {
|
||||
define.output('summary1', function() {
|
||||
paste(capture.output(print(summary(data$get.value()))), collapse="\n")
|
||||
})
|
||||
@@ -22,10 +22,10 @@
|
||||
<input type="number" name="n" value="500" min="1" max="10000" />
|
||||
</p>
|
||||
|
||||
<img id="plot1" class="live-plot"/>
|
||||
|
||||
<pre id="summary1" class="live-text"></pre>
|
||||
|
||||
<img id="plot1" class="live-plot"/>
|
||||
|
||||
<div id="table1" class="live-html"></div>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user