library(shiny)
library(DBI)
mydb <- dbConnect(RSQLite::SQLite(), "my-db.sqlite")
Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
,textInput("fname","Enter you First Name")
,dateInput("dob", "Enter your Date of Birth")
,numericInput("age", "Enter you Age", value = 2)
,selectInput("city","Select your City", choices = c("rao","mohsin"))
,radioButtons("rb", "buttons_to_log",
choices = letters[1:13])
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
,htmlOutput("showallvalues")
)
)
)
Define server logic required to draw a histogram
server <- function(input, output, session) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$showallvalues <- renderText({
paste("<h1>rao mohsin khan</h1>")
})
observeEvent(input$rb, {
if (!DBI::dbExistsTable(mydb, "button_log")) {
DBI::dbCreateTable(
conn = mydb,
name = "button_log",
fields = c(
when = "text",
what = "text")
)
}
DBI::dbAppendTable(
conn = mydb,
name = "button_log",
value = data.frame(
when = as.character(Sys.time()),
what = input$rb)
)
})
}
shinyApp(ui = ui, server = server)