Open sankarachari opened 6 years ago
You might want to adapt this to your csv input:
library(shiny)
library(shinydashboard)
somedata <- data.frame(from=letters, message=LETTERS)
write.csv(somedata, file="messages.csv")
ui <- dashboardPage(skin = "red",
dashboardHeader(title = "PSMRI", dropdownMenuOutput("msgOutPut")),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
output$msgOutPut <- renderMenu({
csvdata <- read.csv("messages.csv")
print(csvdata)
msgs <- apply(csvdata, 1, function(row) {
messageItem(from = row[["from"]], message = row[["message"]])
})
print(msgs)
dropdownMenu(type = "messages", .list = msgs)
})
}
shinyApp(ui, server)
Also take a look here.
Ui code: UI code: ui <- shinyUI( dashboardPage(skin = "red", dashboardHeader(title = "PSMRI", dropdownMenuOutput("msgOutPut"))))
Server code: output$msgOutPut <- renderMenu({ msgs <- apply(read.csv("messages.csv"), 1,function(row){ messageItem(from = row[["from"]], message = row[["message"]]) }) dropdownMenu(type = "messages", .list = msgs) })
Error: > runApp('My Dashboard/NewPSMRI.R') Error in FUN(X[[i]], ...) : Expected tag to be of type li
I am not able to trace the error where I did mistake. Can anyone help me out in this error.
I would like to automate the messages in the dropdown list located in the header of the UI.
Thanks in advance.