...Please, I am trying to develop an app that would have sentiment analysis as one of its functions. I want the text areas of the sentiment analysis part of the app to have default values, so that once the app is loaded, there are tables and graphs created from the default text values in the text areas, which have been analyzed using the sentiment analysis package. Then once the text fields are cleared, a user can then input his texts and run a sentiment analysis. I wrote the codes for the sentiment analysis, and tried to display results in a data table, using data.frame() function in the server. But I keep getting the following error message whenever I run the app:
Warning: Error in $.shinyoutput: Reading objects from shinyoutput object not allowed.
50: stop
49: $.shinyoutput
47: server [C:/Users/Idiaye/Documents/Analytic.R#35]
Error in `$.shinyoutput`(output, table) :
Reading objects from shinyoutput object not allowed.
This is the code for the app:
if(interactive()){
library(shiny)
library(shinycustomloader)
library(shinythemes)
library(SentimentAnalysis)
library(textclean)
ui<-navbarPage(strong("Mavis Analytic"),theme=shinytheme("spacelab"),
windowTitle="Mavis Analytic",fluid=TRUE,inverse=FALSE,
tabPanel(strong("Opinion Miner"),
sidebarLayout(
sidebarPanel(width=3,
h4("Enter your texts in these fields"),br(),
actionButton("clear","Clear Fields"),br(),br(),
textAreaInput("text","Text Field 1",value="It is a beautiful day"),
textAreaInput("texts","Text Field 2",value="I am happy to be here"),
textAreaInput("word","Text Field 3",value="Let's have some fun"),
textAreaInput("words","Text Field 4",value="It has been a tough journey"),
textAreaInput("wordy","Text Field 5",value="I don't like clowns"),
actionButton("run","Run Analysis")
),mainPanel(h4("A table of the sentiment scores across four dictionaries"),withLoader(tableOutput("table"),loader="dnaspin")))),
tabPanel(strong("Financial Ratios Calculator")),
navbarMenu(strong("More"),
tabPanel(strong("Graphs and Charts")),
tabPanel(strong("Tables")))
)
server<-function(input,output,session){
observeEvent(input$clear,{
updateTextAreaInput(session,"text",value="")
updateTextAreaInput(session,"texts",value="")
updateTextAreaInput(session,"word",value="")
updateTextAreaInput(session,"words",value="")
updateTextAreaInput(session,"wordy",value="")
})
output$table<renderDataTable({
data.frame(
QDAP<-Analyze$SentimentQDAP,
LoughranM<-Analyze$SentimentLM,
Henry<-Analyze$SentimentHE,
HarvardIV<-Analyze$SentimentGI
)
})
}
}
Analyze<-replace_symbol(
replace_number(
analyzeSentiment(
doc<-c("input$text","input$texts","input$word","input$words","input$wordy"))))
shinyApp(ui=ui,server=server)
I would really appreciate anybody's help. Thanks.