DF1, DF2, and DF3 are the three data frames I have (in options). While picking DF3 from the second dataset, I'd want to highlight the value "600.00" from the column "Salary" of the 7th Row in Green color in the background in that particular cell. What's the most efficient method to do it in R? Since I'm new to Shiny, could someone please help me?
Below is my Code:
library(shiny)
DF1 <- data.frame(
emp_id = c(1:5),
emp_name = c("Rick","Dan","Michelle","Ryan","Gary"),
salary = c(623.3,515.2,611.0,735.0,844.25))
DF1
DF2 <- data.frame(
emp_id = c(1:6),
emp_name = c("Rick","Dan","Michelle","Ryan","Gary", "Alex"),
salary = c(623.3,515.2,611.0,729.0,843.25, 243.5))
DF3 <- data.frame(
emp_id = c(1:7),
emp_name = c("Rick","Dan","Michelle","Ryan","Gary", "Alex", "Christan"),
salary = c(623.3,515.2,611.0,729.0,843.25, 243.5, 600.0))
shinyApp(
ui = tagList(
navbarPage(
fluidRow(column(6, selectInput("dataset1", "Choose first dataset:",
choices = c("SelectDataSet ", "DF1", "DF2", "DF3"))),
column(6, selectInput("dataset2", "Choose second dataset:",
choices = c("SelectDataSet ", "DF1", "DF2", "DF3")))
),
# Button
downloadButton("downloadData5", "Download")
),
mainPanel(
fluidRow(column(6, tableOutput("table1")),
column(6, tableOutput("table2"))
)
)
),
server = function(input, output,session) {
datasetInput1 <- reactive({
switch(input$dataset1,
"DF1" = DF1,
"DF2" = DF2,
"DF3" = DF3)
})
datasetInput2 <- reactive({
switch(input$dataset2,
"DF1" = DF1,
"DF2" = DF2,
"DF3" = DF3)
})
output$table1 <- renderTable({
datasetInput1()
})
output$table2 <- renderTable({
datasetInput2()
})
}
)
shinyApp(ui, server)

