I have created an app in R shiny with the following dataframe as input
DF <-
variable estimatesum
1 get 0.2468349025
2 new 0.1676732365
3 buy 0.1028425291
4 first 0.0823390287
5 cover 0.0408254469
6 perfect -0.0299153527
These are a set of words from a term document matrix. I have made a dataframe with a series of percentages associated with the same. next I am creating a ui and server to process a text to the server and yield a result
ui<- fluidPage(
textInput("message", label = "message",placeholder =
"'"),actionButton("do", "Click Me"),
numericInput("size", label = "size", value =
c(10000000)),
dateInput("Date",label = "Date"),
mainPanel(verbatimTextOutput("Output1")))
Next I am creating a server script. On pressing the actionButton above, the data should be fed into the server and the output should be displayed in the main panel
server<-function(input, output, session) {
text2<-reactive({input$message
mycorpus2<-Corpus(VectorSource(text2))
mycorpus2<-tm_map(mycorpus2, tolower)
mycorpus2<-tm_map(mycorpus2, removeNumbers)
mycorpus2<-tm_map(mycorpus2, removeWords, c(stopwords("english")))
dtm2<-TermDocumentMatrix(mycorpus2)
m2<-as.matrix(dtm2)
v2 <- sort(rowSums(m2),decreasing=TRUE)
d2 <- data.frame(word = names(v2),freq=v2)
outputtable<-DF4[DF4$variable%in%d2$word,]
return(output)
})
output$Output1=renderPrint({sum(outputtable$estimatesum)})}
shinyApp(ui, server)
I am getting the following error repeatedly.
object 'outputtable' not found.
It seems the data from the input are not getting fed into the server. I am unable to identify the error and request some help here. Will be thankful. I am a newbie to r shiny
dput(head(x,n=10))or actual calls todata.frameorread.table? It is much faster (for us) to copy/paste something like that; further, some aspects of the data can be masked when given in this format. - r2evans