Getting Error while printing an Output

Warning: Error in as.vector: cannot coerce type 'closure' to vector of type 'character'
56: as.character.default
54: lapply
53: .makeMessage
52: message
51: startConversation [#21]
50: server [#26]
Error in as.vector(x, "character") :
cannot coerce type 'closure' to vector of type 'character'

[11:26 AM] Sudhanshu
    
library(shiny)
library(shinydashboardPlus)
library(shinydashboard)
library(shinyjs)
library(shinyWidgets)
library(tidyverse)
library(dplyr)
library(excelR)
library(readxl)
library(readr)

#Defining UI Here


ui<- fluidPage(useShinyjs(),tags$head(tags$link(rel="stylesheet", href="style.css")),
               
               titlePanel(""),
               fluidRow(column( width = 5,
                                div(id='outDiv',
                                    
                                    panel(style = "overflow-y:scroll; max-height: 300px; position:relative; align: centre",
                                          
                                          textInput("message", label = "",placeholder = "Type your message here."),
                                          actionButton("send", "Send"), heading = "Smart Advisor", status = "primary")
                                )
               )
               ))





# Defining Server Controls


server<- function(input, output, session)
{
  # Declaring and Initializing Global Variables
  i <- 1
  lvl <- reactiveVal()
  lvl(i)
  


  # Main Function
  startConversation<- function() 
  {
    
    insertUI(
      selector = "#message",
      where = "beforeBegin",
      ui=div(class="chat-bubbles",
             div(class="bubble",
                 p( "Hello, can I get your name please?")
             )))
    message('level is',lvl)


  }
  
  startConversation()
  
  
}


# Calling Shiny Application


shinyApp(ui, server)

when you reference a reactive you should do so as though it were a function.
i.e. lvl()

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.