mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Remove shinyUI() and shinyServer() from examples
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
#' @seealso \code{\link{column}}, \code{\link{sidebarLayout}}
|
||||
#'
|
||||
#' @examples
|
||||
#' shinyUI(fluidPage(
|
||||
#' fluidPage(
|
||||
#'
|
||||
#' # Application title
|
||||
#' titlePanel("Hello Shiny!"),
|
||||
@@ -52,9 +52,9 @@
|
||||
#' plotOutput("distPlot")
|
||||
#' )
|
||||
#' )
|
||||
#' ))
|
||||
#' )
|
||||
#'
|
||||
#' shinyUI(fluidPage(
|
||||
#' fluidPage(
|
||||
#' title = "Hello Shiny!",
|
||||
#' fluidRow(
|
||||
#' column(width = 4,
|
||||
@@ -64,7 +64,7 @@
|
||||
#' "3 offset 2"
|
||||
#' )
|
||||
#' )
|
||||
#' ))
|
||||
#' )
|
||||
#'
|
||||
#' @rdname fluidPage
|
||||
#' @export
|
||||
@@ -115,7 +115,7 @@ fluidRow <- function(...) {
|
||||
#' @seealso \code{\link{column}}
|
||||
#'
|
||||
#' @examples
|
||||
#' shinyUI(fixedPage(
|
||||
#' fixedPage(
|
||||
#' title = "Hello, Shiny!",
|
||||
#' fixedRow(
|
||||
#' column(width = 4,
|
||||
@@ -125,7 +125,7 @@ fluidRow <- function(...) {
|
||||
#' "3 offset 2"
|
||||
#' )
|
||||
#' )
|
||||
#' ))
|
||||
#' )
|
||||
#'
|
||||
#' @rdname fixedPage
|
||||
#' @export
|
||||
@@ -227,7 +227,7 @@ titlePanel <- function(title, windowTitle=title) {
|
||||
#'
|
||||
#' @examples
|
||||
#' # Define UI
|
||||
#' shinyUI(fluidPage(
|
||||
#' fluidPage(
|
||||
#'
|
||||
#' # Application title
|
||||
#' titlePanel("Hello Shiny!"),
|
||||
@@ -248,7 +248,7 @@ titlePanel <- function(title, windowTitle=title) {
|
||||
#' plotOutput("distPlot")
|
||||
#' )
|
||||
#' )
|
||||
#' ))
|
||||
#' )
|
||||
#'
|
||||
#' @export
|
||||
sidebarLayout <- function(sidebarPanel,
|
||||
@@ -286,13 +286,13 @@ sidebarLayout <- function(sidebarPanel,
|
||||
#' @seealso \code{\link{fluidPage}}, \code{\link{flowLayout}}
|
||||
#'
|
||||
#' @examples
|
||||
#' shinyUI(fluidPage(
|
||||
#' fluidPage(
|
||||
#' verticalLayout(
|
||||
#' a(href="http://example.com/link1", "Link One"),
|
||||
#' a(href="http://example.com/link2", "Link Two"),
|
||||
#' a(href="http://example.com/link3", "Link Three")
|
||||
#' )
|
||||
#' ))
|
||||
#' )
|
||||
#' @export
|
||||
verticalLayout <- function(..., fluid = TRUE) {
|
||||
lapply(list(...), function(row) {
|
||||
|
||||
@@ -196,7 +196,7 @@ collapseSizes <- function(padding) {
|
||||
#'
|
||||
#' @examples
|
||||
#' # Define UI
|
||||
#' shinyUI(pageWithSidebar(
|
||||
#' pageWithSidebar(
|
||||
#'
|
||||
#' # Application title
|
||||
#' headerPanel("Hello Shiny!"),
|
||||
@@ -214,7 +214,7 @@ collapseSizes <- function(padding) {
|
||||
#' mainPanel(
|
||||
#' plotOutput("distPlot")
|
||||
#' )
|
||||
#' ))
|
||||
#' )
|
||||
#'
|
||||
#' @export
|
||||
pageWithSidebar <- function(headerPanel,
|
||||
@@ -291,13 +291,13 @@ pageWithSidebar <- function(headerPanel,
|
||||
#' \code{\link{updateNavbarPage}}
|
||||
#'
|
||||
#' @examples
|
||||
#' shinyUI(navbarPage("App Title",
|
||||
#' navbarPage("App Title",
|
||||
#' tabPanel("Plot"),
|
||||
#' tabPanel("Summary"),
|
||||
#' tabPanel("Table")
|
||||
#' ))
|
||||
#' )
|
||||
#'
|
||||
#' shinyUI(navbarPage("App Title",
|
||||
#' navbarPage("App Title",
|
||||
#' tabPanel("Plot"),
|
||||
#' navbarMenu("More",
|
||||
#' tabPanel("Summary"),
|
||||
@@ -305,7 +305,7 @@ pageWithSidebar <- function(headerPanel,
|
||||
#' "Section header",
|
||||
#' tabPanel("Table")
|
||||
#' )
|
||||
#' ))
|
||||
#' )
|
||||
#' @export
|
||||
navbarPage <- function(title,
|
||||
...,
|
||||
@@ -679,7 +679,7 @@ tabsetPanel <- function(...,
|
||||
#'
|
||||
#' @seealso \code{\link{tabPanel}}, \code{\link{updateNavlistPanel}}
|
||||
#' @examples
|
||||
#' shinyUI(fluidPage(
|
||||
#' fluidPage(
|
||||
#'
|
||||
#' titlePanel("Application Title"),
|
||||
#'
|
||||
@@ -689,7 +689,7 @@ tabsetPanel <- function(...,
|
||||
#' tabPanel("Second"),
|
||||
#' tabPanel("Third")
|
||||
#' )
|
||||
#' ))
|
||||
#' )
|
||||
#' @export
|
||||
navlistPanel <- function(...,
|
||||
id = NULL,
|
||||
@@ -1493,11 +1493,11 @@ downloadLink <- function(outputId, label="Download", class=NULL) {
|
||||
#' # add an icon to a submit button
|
||||
#' submitButton("Update View", icon = icon("refresh"))
|
||||
#'
|
||||
#' shinyUI(navbarPage("App Title",
|
||||
#' navbarPage("App Title",
|
||||
#' tabPanel("Plot", icon = icon("bar-chart-o")),
|
||||
#' tabPanel("Summary", icon = icon("list-alt")),
|
||||
#' tabPanel("Table", icon = icon("table"))
|
||||
#' ))
|
||||
#' )
|
||||
#'
|
||||
#' @export
|
||||
icon <- function(name, class = NULL, lib = "font-awesome") {
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' # server.R
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#' output$plot <- renderPlot({
|
||||
#' progress <- shiny::Progress$new(session, min=1, max=15)
|
||||
#' on.exit(progress$close())
|
||||
@@ -71,7 +71,7 @@
|
||||
#' }
|
||||
#' plot(cars)
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @seealso \code{\link{withProgress}}
|
||||
#' @format NULL
|
||||
@@ -206,7 +206,7 @@ Progress <- R6Class(
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' # server.R
|
||||
#' shinyServer(function(input, output) {
|
||||
#' function(input, output) {
|
||||
#' output$plot <- renderPlot({
|
||||
#' withProgress(message = 'Calculation in progress',
|
||||
#' detail = 'This may take a while...', value = 0, {
|
||||
@@ -217,7 +217,7 @@ Progress <- R6Class(
|
||||
#' })
|
||||
#' plot(cars)
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @seealso \code{\link{Progress}}
|
||||
#' @rdname withProgress
|
||||
|
||||
@@ -932,7 +932,7 @@ setAutoflush <- local({
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' # Anything that calls autoInvalidate will automatically invalidate
|
||||
#' # every 2 seconds.
|
||||
@@ -955,7 +955,7 @@ setAutoflush <- local({
|
||||
#' autoInvalidate()
|
||||
#' hist(isolate(input$n))
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' @export
|
||||
@@ -1010,7 +1010,7 @@ reactiveTimer <- function(intervalMs=1000, session = getDefaultReactiveDomain())
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # Re-execute this reactive expression after 1000 milliseconds
|
||||
@@ -1029,7 +1029,7 @@ reactiveTimer <- function(intervalMs=1000, session = getDefaultReactiveDomain())
|
||||
#' invalidateLater(2000)
|
||||
#' hist(isolate(input$n))
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' @export
|
||||
@@ -1103,12 +1103,12 @@ coerceToFunc <- function(x) {
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' # Assume the existence of readTimestamp and readValue functions
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#' data <- reactivePoll(1000, session, readTimestamp, readValue)
|
||||
#' output$dataTable <- renderTable({
|
||||
#' data()
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
#' @export
|
||||
@@ -1170,7 +1170,7 @@ reactivePoll <- function(intervalMillis, session, checkFunc, valueFunc) {
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' # Per-session reactive file reader
|
||||
#' shinyServer(function(input, output, session)) {
|
||||
#' function(input, output, session) {
|
||||
#' fileData <- reactiveFileReader(1000, session, 'data.csv', read.csv)
|
||||
#'
|
||||
#' output$data <- renderTable({
|
||||
@@ -1182,7 +1182,7 @@ reactivePoll <- function(intervalMillis, session, checkFunc, valueFunc) {
|
||||
#' # the same reader, so read.csv only gets executed once no matter how many
|
||||
#' # user sessions are connected.
|
||||
#' fileData <- reactiveFileReader(1000, session, 'data.csv', read.csv)
|
||||
#' shinyServer(function(input, output, session)) {
|
||||
#' function(input, output, session) {
|
||||
#' output$data <- renderTable({
|
||||
#' fileData()
|
||||
#' })
|
||||
|
||||
@@ -133,7 +133,7 @@ as.tags.shiny.render.function <- function(x, ..., inline = FALSE) {
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#'
|
||||
#' shinyServer(function(input, output, clientData) {
|
||||
#' function(input, output, clientData) {
|
||||
#'
|
||||
#' # A plot of fixed size
|
||||
#' output$plot1 <- renderImage({
|
||||
@@ -181,7 +181,7 @@ as.tags.shiny.render.function <- function(x, ..., inline = FALSE) {
|
||||
#' # Return a list containing the filename
|
||||
#' list(src = filename)
|
||||
#' }, deleteFile = FALSE)
|
||||
#' })
|
||||
#' }
|
||||
#'
|
||||
#' }
|
||||
renderImage <- function(expr, env=parent.frame(), quoted=FALSE,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -22,7 +22,7 @@
|
||||
#' label = paste("New label", x),
|
||||
#' value = paste("New text", x))
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateTextInput <- function(session, inputId, label = NULL, value = NULL) {
|
||||
@@ -40,7 +40,7 @@ updateTextInput <- function(session, inputId, label = NULL, value = NULL) {
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # TRUE if input$controller is even, FALSE otherwise.
|
||||
@@ -48,7 +48,7 @@ updateTextInput <- function(session, inputId, label = NULL, value = NULL) {
|
||||
#'
|
||||
#' updateCheckboxInput(session, "inCheckbox", value = x_even)
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateCheckboxInput <- updateTextInput
|
||||
@@ -64,7 +64,7 @@ updateCheckboxInput <- updateTextInput
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # Updates goButton's label and icon
|
||||
@@ -82,7 +82,7 @@ updateCheckboxInput <- updateTextInput
|
||||
#' updateActionButton(session, "goButton3",
|
||||
#' label = "New label")
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateActionButton <- function(session, inputId, label = NULL, icon = NULL) {
|
||||
@@ -106,7 +106,7 @@ updateActionButton <- function(session, inputId, label = NULL, icon = NULL) {
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -120,7 +120,7 @@ updateActionButton <- function(session, inputId, label = NULL, icon = NULL) {
|
||||
#' max = paste("2013-04-", x+1, sep="")
|
||||
#' )
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateDateInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
@@ -153,7 +153,7 @@ updateDateInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -165,7 +165,7 @@ updateDateInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
#' start = paste("2013-01-", x, sep=""))
|
||||
#' end = paste("2013-12-", x, sep=""))
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateDateRangeInput <- function(session, inputId, label = NULL,
|
||||
@@ -201,7 +201,7 @@ updateDateRangeInput <- function(session, inputId, label = NULL,
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # TRUE if input$controller is even, FALSE otherwise.
|
||||
@@ -215,7 +215,7 @@ updateDateRangeInput <- function(session, inputId, label = NULL,
|
||||
#' updateTabsetPanel(session, "inTabset", selected = "panel1")
|
||||
#' }
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateTabsetPanel <- function(session, inputId, selected = NULL) {
|
||||
@@ -243,7 +243,7 @@ updateNavlistPanel <- updateTabsetPanel
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -256,7 +256,7 @@ updateNavlistPanel <- updateTabsetPanel
|
||||
#' label = paste("Number label ", x),
|
||||
#' value = x, min = x-10, max = x+10, step = 5)
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateNumericInput <- function(session, inputId, label = NULL, value = NULL,
|
||||
@@ -369,7 +369,7 @@ updateInputOptions <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -392,7 +392,7 @@ updateInputOptions <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#' selected = sprintf("option-%d-2", x)
|
||||
#' )
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateCheckboxGroupInput <- function(session, inputId, label = NULL,
|
||||
@@ -411,7 +411,7 @@ updateCheckboxGroupInput <- function(session, inputId, label = NULL,
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -432,7 +432,7 @@ updateCheckboxGroupInput <- function(session, inputId, label = NULL,
|
||||
#' selected = sprintf("option-%d-2", x)
|
||||
#' )
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateRadioButtons <- function(session, inputId, label = NULL, choices = NULL,
|
||||
@@ -452,7 +452,7 @@ updateRadioButtons <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#'
|
||||
#' @examples
|
||||
#' \dontrun{
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' observe({
|
||||
#' # We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -476,7 +476,7 @@ updateRadioButtons <- function(session, inputId, label = NULL, choices = NULL,
|
||||
#' selected = sprintf("option-%d-2", x)
|
||||
#' )
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#' @export
|
||||
updateSelectInput <- function(session, inputId, label = NULL, choices = NULL,
|
||||
|
||||
@@ -478,7 +478,7 @@ installExprFunction <- function(expr, name, eval.env = parent.frame(2),
|
||||
#'
|
||||
#' \dontrun{
|
||||
#' # Example of usage within a Shiny app
|
||||
#' shinyServer(function(input, output, session) {
|
||||
#' function(input, output, session) {
|
||||
#'
|
||||
#' output$queryText <- renderText({
|
||||
#' query <- parseQueryString(session$clientData$url_search)
|
||||
@@ -494,7 +494,7 @@ installExprFunction <- function(expr, name, eval.env = parent.frame(2),
|
||||
#' # Return a string with key-value pairs
|
||||
#' paste(names(query), query, sep = "=", collapse=", ")
|
||||
#' })
|
||||
#' })
|
||||
#' }
|
||||
#' }
|
||||
#'
|
||||
parseQueryString <- function(str, nested = FALSE) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define server logic required to draw a histogram
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
|
||||
# Expression that generates a histogram. The expression is
|
||||
# wrapped in a call to renderPlot to indicate that:
|
||||
@@ -18,4 +18,4 @@ shinyServer(function(input, output) {
|
||||
hist(x, breaks = bins, col = 'darkgray', border = 'white')
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define UI for application that draws a histogram
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Hello Shiny!"),
|
||||
@@ -21,4 +21,4 @@ shinyUI(fluidPage(
|
||||
plotOutput("distPlot")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ library(datasets)
|
||||
|
||||
# Define server logic required to summarize and view the selected
|
||||
# dataset
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
|
||||
# Return the requested dataset
|
||||
datasetInput <- reactive({
|
||||
@@ -23,4 +23,4 @@ shinyServer(function(input, output) {
|
||||
output$view <- renderTable({
|
||||
head(datasetInput(), n = input$obs)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define UI for dataset viewer application
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Shiny Text"),
|
||||
@@ -24,4 +24,4 @@ shinyUI(fluidPage(
|
||||
tableOutput("view")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ library(datasets)
|
||||
|
||||
# Define server logic required to summarize and view the selected
|
||||
# dataset
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
|
||||
# By declaring datasetInput as a reactive expression we ensure
|
||||
# that:
|
||||
@@ -50,4 +50,4 @@ shinyServer(function(input, output) {
|
||||
output$view <- renderTable({
|
||||
head(datasetInput(), n = input$obs)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define UI for dataset viewer application
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Reactivity"),
|
||||
@@ -31,4 +31,4 @@ shinyUI(fluidPage(
|
||||
tableOutput("view")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ mpgData$am <- factor(mpgData$am, labels = c("Automatic", "Manual"))
|
||||
|
||||
# Define server logic required to plot various variables against
|
||||
# mpg
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
|
||||
# Compute the formula text in a reactive expression since it is
|
||||
# shared by the output$caption and output$mpgPlot functions
|
||||
@@ -31,4 +31,4 @@ shinyServer(function(input, output) {
|
||||
data = mpgData,
|
||||
outline = input$outliers)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define UI for miles per gallon application
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Miles Per Gallon"),
|
||||
@@ -26,4 +26,4 @@ shinyUI(fluidPage(
|
||||
plotOutput("mpgPlot")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define server logic for slider examples
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
|
||||
# Reactive expression to compose a data frame containing all of
|
||||
# the values
|
||||
@@ -26,4 +26,4 @@ shinyServer(function(input, output) {
|
||||
output$values <- renderTable({
|
||||
sliderValues()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define UI for slider demo application
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Sliders"),
|
||||
@@ -40,4 +40,4 @@ shinyUI(fluidPage(
|
||||
tableOutput("values")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define server logic for random distribution application
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
|
||||
# Reactive expression to generate the requested distribution.
|
||||
# This is called whenever the inputs change. The output
|
||||
@@ -41,4 +41,4 @@ shinyServer(function(input, output) {
|
||||
data.frame(x=data())
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define UI for random distribution application
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Tabsets"),
|
||||
@@ -35,4 +35,4 @@ shinyUI(fluidPage(
|
||||
)
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ library(datasets)
|
||||
|
||||
# Define server logic required to summarize and view the
|
||||
# selected dataset
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
|
||||
# Return the requested dataset
|
||||
datasetInput <- reactive({
|
||||
@@ -23,4 +23,4 @@ shinyServer(function(input, output) {
|
||||
output$view <- renderTable({
|
||||
head(datasetInput(), n = input$obs)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define UI for dataset viewer application
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title.
|
||||
titlePanel("More Widgets"),
|
||||
@@ -40,4 +40,4 @@ shinyUI(fluidPage(
|
||||
tableOutput("view")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
library(shiny)
|
||||
|
||||
# Define server logic for random distribution application
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
|
||||
# Reactive expression to generate the requested distribution. This is
|
||||
# called whenever the inputs change. The output expressions defined
|
||||
@@ -39,4 +39,4 @@ shinyServer(function(input, output) {
|
||||
data.frame(x=data())
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
library(shiny)
|
||||
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
output$contents <- renderTable({
|
||||
|
||||
# input$file1 will be NULL initially. After the user selects
|
||||
@@ -17,4 +17,4 @@ shinyServer(function(input, output) {
|
||||
read.csv(inFile$datapath, header=input$header, sep=input$sep,
|
||||
quote=input$quote)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
library(shiny)
|
||||
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
titlePanel("Uploading Files"),
|
||||
sidebarLayout(
|
||||
sidebarPanel(
|
||||
@@ -25,4 +25,4 @@ shinyUI(fluidPage(
|
||||
tableOutput('contents')
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
datasetInput <- reactive({
|
||||
switch(input$dataset,
|
||||
"rock" = rock,
|
||||
@@ -18,4 +18,4 @@ shinyServer(function(input, output) {
|
||||
write.csv(datasetInput(), file)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
titlePanel('Downloading Data'),
|
||||
sidebarLayout(
|
||||
sidebarPanel(
|
||||
@@ -10,4 +10,4 @@ shinyUI(fluidPage(
|
||||
tableOutput('table')
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
output$currentTime <- renderText({
|
||||
invalidateLater(1000, session)
|
||||
paste("The current time is", Sys.time())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
textOutput("currentTime")
|
||||
))
|
||||
)
|
||||
|
||||
@@ -71,7 +71,7 @@ to be removed.
|
||||
\examples{
|
||||
\dontrun{
|
||||
# server.R
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
output$plot <- renderPlot({
|
||||
progress <- shiny::Progress$new(session, min=1, max=15)
|
||||
on.exit(progress$close())
|
||||
@@ -85,7 +85,7 @@ shinyServer(function(input, output, session) {
|
||||
}
|
||||
plot(cars)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -46,7 +46,7 @@ See the \href{http://shiny.rstudio.com/articles/layout-guide.html}{
|
||||
pages.
|
||||
}
|
||||
\examples{
|
||||
shinyUI(fixedPage(
|
||||
fixedPage(
|
||||
title = "Hello, Shiny!",
|
||||
fixedRow(
|
||||
column(width = 4,
|
||||
@@ -56,7 +56,7 @@ shinyUI(fixedPage(
|
||||
"3 offset 2"
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -45,7 +45,7 @@ See the \href{http://shiny.rstudio.com/articles/layout-guide.html}{
|
||||
pages.
|
||||
}
|
||||
\examples{
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Hello Shiny!"),
|
||||
@@ -66,9 +66,9 @@ shinyUI(fluidPage(
|
||||
plotOutput("distPlot")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
title = "Hello Shiny!",
|
||||
fluidRow(
|
||||
column(width = 4,
|
||||
@@ -78,7 +78,7 @@ shinyUI(fluidPage(
|
||||
"3 offset 2"
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -36,11 +36,11 @@ icon("cog", lib = "glyphicon") # From glyphicon library
|
||||
# add an icon to a submit button
|
||||
submitButton("Update View", icon = icon("refresh"))
|
||||
|
||||
shinyUI(navbarPage("App Title",
|
||||
navbarPage("App Title",
|
||||
tabPanel("Plot", icon = icon("bar-chart-o")),
|
||||
tabPanel("Summary", icon = icon("list-alt")),
|
||||
tabPanel("Table", icon = icon("table"))
|
||||
))
|
||||
)
|
||||
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -29,7 +29,7 @@ possible to stop this cycle by adding conditional logic that prevents the
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# Re-execute this reactive expression after 1000 milliseconds
|
||||
@@ -48,7 +48,7 @@ shinyServer(function(input, output, session) {
|
||||
invalidateLater(2000)
|
||||
hist(isolate(input$n))
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -80,13 +80,13 @@ The \code{navbarMenu} function can be used to create an embedded
|
||||
example below).
|
||||
}
|
||||
\examples{
|
||||
shinyUI(navbarPage("App Title",
|
||||
navbarPage("App Title",
|
||||
tabPanel("Plot"),
|
||||
tabPanel("Summary"),
|
||||
tabPanel("Table")
|
||||
))
|
||||
)
|
||||
|
||||
shinyUI(navbarPage("App Title",
|
||||
navbarPage("App Title",
|
||||
tabPanel("Plot"),
|
||||
navbarMenu("More",
|
||||
tabPanel("Summary"),
|
||||
@@ -94,7 +94,7 @@ shinyUI(navbarPage("App Title",
|
||||
"Section header",
|
||||
tabPanel("Table")
|
||||
)
|
||||
))
|
||||
)
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{tabPanel}}, \code{\link{tabsetPanel}},
|
||||
|
||||
@@ -40,7 +40,7 @@ You can include headers within the \code{navlistPanel} by including
|
||||
doesn't support separators.
|
||||
}
|
||||
\examples{
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
titlePanel("Application Title"),
|
||||
|
||||
@@ -50,7 +50,7 @@ shinyUI(fluidPage(
|
||||
tabPanel("Second"),
|
||||
tabPanel("Third")
|
||||
)
|
||||
))
|
||||
)
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{tabPanel}}, \code{\link{updateNavlistPanel}}
|
||||
|
||||
@@ -26,7 +26,7 @@ along with \code{\link{sidebarLayout}} to implement a page with a sidebar.
|
||||
}
|
||||
\examples{
|
||||
# Define UI
|
||||
shinyUI(pageWithSidebar(
|
||||
pageWithSidebar(
|
||||
|
||||
# Application title
|
||||
headerPanel("Hello Shiny!"),
|
||||
@@ -44,7 +44,7 @@ shinyUI(pageWithSidebar(
|
||||
mainPanel(
|
||||
plotOutput("distPlot")
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ parseQueryString("?foo=1&bar=b\%20a\%20r")
|
||||
|
||||
\dontrun{
|
||||
# Example of usage within a Shiny app
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
output$queryText <- renderText({
|
||||
query <- parseQueryString(session$clientData$url_search)
|
||||
@@ -40,7 +40,7 @@ shinyServer(function(input, output, session) {
|
||||
# Return a string with key-value pairs
|
||||
paste(names(query), query, sep = "=", collapse=", ")
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ reactive values and reactive expressions.
|
||||
\examples{
|
||||
\dontrun{
|
||||
# Per-session reactive file reader
|
||||
shinyServer(function(input, output, session)) {
|
||||
function(input, output, session) {
|
||||
fileData <- reactiveFileReader(1000, session, 'data.csv', read.csv)
|
||||
|
||||
output$data <- renderTable({
|
||||
@@ -59,7 +59,7 @@ shinyServer(function(input, output, session)) {
|
||||
# the same reader, so read.csv only gets executed once no matter how many
|
||||
# user sessions are connected.
|
||||
fileData <- reactiveFileReader(1000, session, 'data.csv', read.csv)
|
||||
shinyServer(function(input, output, session)) {
|
||||
function(input, output, session) {
|
||||
output$data <- renderTable({
|
||||
fileData()
|
||||
})
|
||||
|
||||
@@ -59,12 +59,12 @@ values and reactive expressions.
|
||||
\examples{
|
||||
\dontrun{
|
||||
# Assume the existence of readTimestamp and readValue functions
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
data <- reactivePoll(1000, session, readTimestamp, readValue)
|
||||
output$dataTable <- renderTable({
|
||||
data()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ See \code{\link{invalidateLater}} as a safer and simpler alternative.
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
# Anything that calls autoInvalidate will automatically invalidate
|
||||
# every 2 seconds.
|
||||
@@ -58,7 +58,7 @@ shinyServer(function(input, output, session) {
|
||||
autoInvalidate()
|
||||
hist(isolate(input$n))
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ the CSS class name \code{shiny-image-output}.
|
||||
\examples{
|
||||
\dontrun{
|
||||
|
||||
shinyServer(function(input, output, clientData) {
|
||||
function(input, output, clientData) {
|
||||
|
||||
# A plot of fixed size
|
||||
output$plot1 <- renderImage({
|
||||
@@ -95,7 +95,7 @@ shinyServer(function(input, output, clientData) {
|
||||
# Return a list containing the filename
|
||||
list(src = filename)
|
||||
}, deleteFile = FALSE)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ area occupies 2/3 of the horizontal width and typically contains outputs.
|
||||
}
|
||||
\examples{
|
||||
# Define UI
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
|
||||
# Application title
|
||||
titlePanel("Hello Shiny!"),
|
||||
@@ -46,7 +46,7 @@ shinyUI(fluidPage(
|
||||
plotOutput("distPlot")
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# Updates goButton's label and icon
|
||||
@@ -56,7 +56,7 @@ shinyServer(function(input, output, session) {
|
||||
updateActionButton(session, "goButton3",
|
||||
label = "New label")
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -43,7 +43,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -66,7 +66,7 @@ shinyServer(function(input, output, session) {
|
||||
selected = sprintf("option-\%d-2", x)
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -37,7 +37,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# TRUE if input$controller is even, FALSE otherwise.
|
||||
@@ -45,7 +45,7 @@ shinyServer(function(input, output, session) {
|
||||
|
||||
updateCheckboxInput(session, "inCheckbox", value = x_even)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -45,7 +45,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -59,7 +59,7 @@ shinyServer(function(input, output, session) {
|
||||
max = paste("2013-04-", x+1, sep="")
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -48,7 +48,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -60,7 +60,7 @@ shinyServer(function(input, output, session) {
|
||||
start = paste("2013-01-", x, sep=""))
|
||||
end = paste("2013-12-", x, sep=""))
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -44,7 +44,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -57,7 +57,7 @@ shinyServer(function(input, output, session) {
|
||||
label = paste("Number label ", x),
|
||||
value = x, min = x-10, max = x+10, step = 5)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -44,7 +44,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -65,7 +65,7 @@ shinyServer(function(input, output, session) {
|
||||
selected = sprintf("option-\%d-2", x)
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -57,7 +57,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -81,7 +81,7 @@ shinyServer(function(input, output, session) {
|
||||
selected = sprintf("option-\%d-2", x)
|
||||
)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -26,7 +26,7 @@ Change the selected tab on the client
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# TRUE if input$controller is even, FALSE otherwise.
|
||||
@@ -40,7 +40,7 @@ shinyServer(function(input, output, session) {
|
||||
updateTabsetPanel(session, "inTabset", selected = "panel1")
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -37,7 +37,7 @@ For \code{\link{radioButtons}()}, \code{\link{checkboxGroupInput}()} and
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
shinyServer(function(input, output, session) {
|
||||
function(input, output, session) {
|
||||
|
||||
observe({
|
||||
# We'll use the input$controller variable multiple times, so save it as x
|
||||
@@ -52,7 +52,7 @@ shinyServer(function(input, output, session) {
|
||||
label = paste("New label", x),
|
||||
value = paste("New text", x))
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
@@ -17,13 +17,13 @@ Create a container that includes one or more rows of content (each element
|
||||
passed to the container will appear on it's own line in the UI)
|
||||
}
|
||||
\examples{
|
||||
shinyUI(fluidPage(
|
||||
fluidPage(
|
||||
verticalLayout(
|
||||
a(href="http://example.com/link1", "Link One"),
|
||||
a(href="http://example.com/link2", "Link Two"),
|
||||
a(href="http://example.com/link3", "Link Three")
|
||||
)
|
||||
))
|
||||
)
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{fluidPage}}, \code{\link{flowLayout}}
|
||||
|
||||
@@ -76,7 +76,7 @@ case, you can use the \code{Progress} reference class.
|
||||
\examples{
|
||||
\dontrun{
|
||||
# server.R
|
||||
shinyServer(function(input, output) {
|
||||
function(input, output) {
|
||||
output$plot <- renderPlot({
|
||||
withProgress(message = 'Calculation in progress',
|
||||
detail = 'This may take a while...', value = 0, {
|
||||
@@ -87,7 +87,7 @@ shinyServer(function(input, output) {
|
||||
})
|
||||
plot(cars)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
||||
Reference in New Issue
Block a user