Hello everyone, i'm trying to create my first ShinyApp and as expected i'm facing a lot of problems but most of them are quite simple.
The function of the App is basically receive a bunch of values of different variables, transform some of them, and then print a table with the original variables and the transformed ones.
The ideia is to do more things, but as they say: one step at a time
So, here follow the code, i already try a lot of different types of functions related to print table as an output but nothing is working
library(shiny)
ui <- fluidPage(
h1("Multi-simulator test"),
numericInput("age","Age",18,min=18,max=90),
verbatimTextOutput("value"),
numericInput("dlage","Drive-license Age",1,min=1,max=80),
verbatimTextOutput("value"),
numericInput("pp","Power rate (Horsepower/Gross-Weight)",0.1,min=0.1,max=10),
verbatimTextOutput("value"),
numericInput("cc","Cilinders",1,min=1,max=10000),
verbatimTextOutput("value"),
numericInput("kids","Have kids? (yes=1,no=0)",0,min=0,max=1),
verbatimTextOutput("value"),
numericInput("car_year","Year of the car",1950,min=1950,max=3000),
verbatimTextOutput("value"),
numericInput("lisbon","Live in Lisbon? (yes=1,no=0)",0,min=0,max=1),
verbatimTextOutput("value"),
tags$hr(),
checkboxInput("CoA", "Company A", TRUE),
checkboxInput("CoB", "Company B", TRUE),
checkboxInput("CoC", "Company C", TRUE),
mainPanel(
tableOutput("table")
)
)
server <- function(input, output) {
# Reactive value for selected dataset ----
input$car_age <- reactive(2019 - input$car_year)
data <- reactive({data.frame(Age=input$age,Car_Age=input$car_age,
Dl_age=input$dlage,Power_rate=input$pp,
Cilinders=input$cc,Kids=input$kids,
Lisbon=input$lisbon)})
# Table of selected dataset ----
output$table <- renderTable({
data()
})
}
shinyApp(ui = ui, server = server)