March 23, 2021

R shiny package

shiny package in R

install.packages("shiny")

ui <- fluidPage("Hello", "There")
ui <- fluidPage(h1("Shiny"), "by", strong("Satya"))

shinyApp(ui, server)
titlePanel("Discrete Random Variable - Frequency Distribution")
fluidRow(column(12, verbatimTextOutput("value")))
shinyUI(fluidPage(title = "Expected Value", h3("Instructions"), hr() ))
plotOutput("redPlot")
plotOutput(outputId="my_plot")

actionButton("action", label="Play 10 times", class="btn btn-danger text-center"
p("Click the button to play the game 10 times.")
h1()
h2()
br()
em()
strong()
column(6, h5("Expected Value"), br(), plotOutput("exp_plot") ) )

mainPanel("this is main panel")
mainPanel( plotOutput("plot"), tableOutput("table") )
sidebarPanel("this is side bar")
sidebarPanel(
      h4("Plot parameters"),
      textInput("title", "Plot title", "Car speed vs distance to stop"),
      numericInput("num", "Number of cars to show", 30, 1, nrow(cars)),
      sliderInput("size", "Point size", 1, 5, 2, 0.5)
    )
sidebarLayout(sidebarPanel(), mainPanel())

actionButton()
checkboxInput()
checkboxGroupInput()
dateInput()
dateRangeInput()
fileInput()
numericInput("num", "Number of rows", value=9, min=1)
numericInput(inputId="customers", label="no. of customers", value=4, min=0)
passwordInput()

radioButtons()
selectInput()
sliderInput()
textInput("name", "What is your name?")
textInput(inputId="name", label="Enter your name", value="Satya")
textOutput(outputId = "greeting")
textAreadInput()
colourpicker::colourInput()
renderPlot()
renderText()
renderTable()
xx <- reactive({ input$num + 2 })
sum <- reactive({ input$num1 + input$num2 })
observe({ print(input$num)  print( xx() ) })

Related Articles: ggplot2 package in R       R Matrices


No comments:

Post a Comment