Putting together a shiny app

How are you trying to do it? Have in mind that you are defining answer5 whitin your function, it doesn't exist in the parent environment, i.e. the shiny app, so you can't directly reference answer5, you have to capture the output like in this example. (the output being anything your function returns, but I think your function is returning nothing).

output$predicted_word <- renderText({
    paste("the next word is", whatsnexta(phrase = input$predictor_words))
  })

My function is returning answer5 when running it in the helpers.R window. Just in case, I wrote in return(answer5) at the end of the function, but got the same error message when trying to run Shiny. I don't know how to get answer5 from the shiny environment. Does using the source(helpers.R) function in the app window do something, or not enough (apparently)?

You are assigning the result of answer[1:5, 1] to the answer5 variable, but in the context of your function (the variable only exists within your function), this is not the same as returning a value.
If I was you, I would forget about answer5 and simply return answer[1:5, 1]

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