Issue with dynamic messages when creating a dashboard using shiny R

+4 votes

I'm trying to have a dynamic message functionality on my dashboard which I'm creating using shiny R. This is my code:

server.R

library(shiny)
library(shinydashboard)

shinyServer(function(input,output){
  
  output$`$histogram`<- renderPlot({
  hist(faithful$eruptions,breaks = input$bins)
      })
  output$msgOut <- renderMenu({
  msgs <- apply(read.csv("msg.csv"),1,function(row){
    messageItem(from = row[["from"]],message = row[["message"]])}
    ) 
  dropdownMenu("messages", .list = msgs)
  })

})

ui.R

library(shiny)
library(shinydashboard)

shinyUI(
  dashboardPage(
    dashboardHeader(title="Edureka",dropdownMenuOutput("msgOut")
                    # dropdownMenu(
                    #   type = "message",
                    #   messageItem(from = "Finance Update",message = "whats up niggas"),
                    #   messageItem(from = "Sales Update",message = "Meeting at 6PM on Monday", time = "15:00",icon = icon("handshake-o"))
                    # )
                   ),
    dashboardSidebar(
      sliderInput("bins","number of breaks",1,100,50),
      sidebarMenu(
      menuItem("Monthly Sales",tabName = "dashboard"),
    menuSubItem("DevOps",tabName = "DevOps"),
    menuSubItem("Blockchain",tabName = "Blockchain"),
    menuSubItem("AWS",tabName = "AWS"),
    menuItem("Finance Dashboard",tabName = "Finance"),
    menuSubItem("Revenue Generated",tabName = "Revenue"),
    menuSubItem("Company Expenditure",tabName = "Expenditure"))
    ),
    dashboardBody(
      tabItems(
        tabItem(tabName = "dashboard",
        fluidRow(
          box(plotOutput("$histogram")))
        ),
        tabItem(tabName = "DevOps",h1("DevOps courses sold")
         ),
        tabItem(tabName = "Blockchain",h1("Blockchain courses sold")
                ),
        tabItem(tabName = "AWS",h1("AWS Courses sold")),
        tabItem(tabName = "Finance",h1("Financial Growth")),
        tabItem(tabName = "Revenue", h1("Revenue Generated")),
        tabItem(tabName = "Expenditure",h1("Company Expenditures"))
  )
    )
  )
)

I get this error when i run the app

Dec 3, 2018 in Data Analytics by Ali
• 11,360 points

recategorized Dec 3, 2018 by Ali 2,857 views

3 answers to this question.

0 votes
Best answer
I had a wrong argument to one of my function, correcting it started working. Thanks @Maverick.
answered Dec 3, 2018 by Ali
• 11,360 points

selected Dec 3, 2018 by Kalgi
+1 vote
Hey @Ali, seems like the file you're trying to open is the wrong one. Check the file name and the extension. Also try adding the entire path of the file. Let me what output you get after this.
answered Dec 3, 2018 by Maverick
• 10,840 points

I get an error saying:

"Error in sourceUTF8(serverR, envir = new.env(parent = globalenv())) :
error sourcing /path/"

Still no luck, I'm getting another error now:

Error: '\U' used without hex digits in character string starting ""C:\U"

I tried this as well. i get this as the output:

error saying:

Expected an object with class 'shiny.tag'
This error occurs when the arguments passed are incorrect. check the arguments.
Yes @Maverick, I had screwed up with arguments with one of the function. Thanks, its working now.
0 votes
Hey @Ali, Start a new session and copy the same code there. I'm not very sure but that has worked for me.
answered Dec 3, 2018 by Hannah
• 18,540 points

Related Questions In Data Analytics

+5 votes
0 answers
0 votes
1 answer

Error saying "ERROR: Expected tag to be of type header" while creating a dashboard using shiny R

sliderInput("bins","number of breaks",1,100,50), this line should come under ...READ MORE

answered Nov 30, 2018 in Data Analytics by Maverick
• 10,840 points
4,531 views
0 votes
1 answer

How do I add Icons to my messages on my dashboard which I’m creating using shiny r?

Try something like this: dashboardHeader(title="Edureka", dropdownMenu type = "message", messageItem(from = ...READ MORE

answered Nov 30, 2018 in Data Analytics by Maverick
• 10,840 points
856 views
0 votes
1 answer

Error saying 'shinyServer(function(input,output){ output`$histogram`" while creating dashboard using shiny R

Try this for your server.R library(shiny) library(shinydashboard) shinyServer(function(input,output){ output$`$histogram`<- ...READ MORE

answered Nov 30, 2018 in Data Analytics by Maverick
• 10,840 points
1,421 views
0 votes
1 answer

issue with dashboardSidebar function using shiny R

You can use the function sidebarMenu function ...READ MORE

answered Nov 30, 2018 in Data Analytics by Maverick
• 10,840 points
567 views
0 votes
1 answer

Replace comma with a period in data cleaning using R

You can use the scan function in ...READ MORE

answered Nov 13, 2018 in Data Analytics by Maverick
• 10,840 points
3,778 views
+1 vote
1 answer

Error saying "could not find function "shinyUI"" in shiny R

Its a small spelling mistake that you've ...READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,840 points
2,597 views
+1 vote
1 answer

Error saying "could not find function dashboardPage" in shiny R

Include this line in the code: Library(shinydashboard) READ MORE

answered Nov 29, 2018 in Data Analytics by Maverick
• 10,840 points
3,594 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP