inst/app/app.R

#' Shiny app
#' 
#' @importFrom shiny fluidPage verbatimTextOutput
#' @importFrom shinyWidgets searchInput

ui<-shiny::fluidPage(
  # Title
  shiny::titlePanel("Find the current weather in your city!"),

 shinyWidgets::searchInput(inputId="city",
                 label="Enter city",
                 placeholder = "Linkoping",
                 btnSearch = shiny::icon("search"),
                 btnReset = shiny::icon("remove"),
    width = "450px"),

    shiny::verbatimTextOutput(outputId = "res"),
 shiny::plotOutput("plot",width = "50%")
)

#' Server function
#' 
#' @importFrom shiny renderPrint
#' @export

server<-function(input,output,session){
  output$res <- shiny::renderPrint({
    weather(input$city)
  })
  output$plot <- shiny::renderPlot({
    plot(weather(input$city))
  })
}

shiny::shinyApp(ui=ui,server=server)
harjew/lab5G3 documentation built on Nov. 4, 2019, 1:28 p.m.