美文网首页
2018-04-25 ShinyApp Basics

2018-04-25 ShinyApp Basics

作者: aldlhy | 来源:发表于2018-04-25 21:24 被阅读0次

    Shiny is an R package that makes it easy to build interactive web apps straight from R.

    # install the latest version of Shiny (shiny_1.0.5)

    Why?

    interactive

    based on R --- extendable

    more time for computations...

    How ?

    Structure of a Shiny App

    3 components:

    ui --- A user interface object which controls the layout and appearance of the app.

    server --- A server function contains the instructions that to build the app.

    runApp --- A call to the shinyApp function.

    Prior to shiny_1.0.2,  Shiny did not support single-file app and ui.R and server.R need to be contained in separate scripts. Now it is still supported but it is mote preferable to use single-file apps.

    Basic setting


    Run a ShinyApp

    In the app folder, 

    library(shiny)

    runApp()

    An example

    It's very informative to use shinyApp to interactively explore and visualize data.

    #####################

    library(shiny)

    ui <- (navbarPage(" App Titile ",

    tabPanel(" tab title", 

    fluidPage(fluidRow(column(2, selectInput="gene", label="Gene", choices=NULL,...)),

    column(...)),

    fluidRow(...)),

    tabPanel()

    ))

    server <- function(input, output){ output$myplot <- renderPlot() 

    }

    shinyApp(ui=ui, server=server)

    runApp("app")

    ######################

    相关文章

      网友评论

          本文标题:2018-04-25 ShinyApp Basics

          本文链接:https://www.haomeiwen.com/subject/gcxulftx.html