How can I properly link my ui and server files for this Shiny app

I am trying to put together a Shiny app; this is far outside what I would normally be doing. Originally, I put together a function (coolFunction below) that takes three inputs:

  1. x - A string
  2. y - A string taken from a list
  3. t - A number

and returns either a data frame or a list. The UI file seems to put everything together correctly:

# Required package for shiny apps

# Possible responses for part of speech
ppos = c("one", "two", "three")

ui <- fluidPage(

# Title using HTML
h1("Cool Title Here", align = "center"),

# Put results in sidebar
        p("Descriptive words"),

# Main panel for instructions and input
# Sidebar for input
h3("Instructions", align = "center"),
p("Words here. Once you've entered all of the required information, click the \"go\" button to get your results."),

# Numbered list of instructions for input

# Item 1
tags$li("Instructions for Point 1."),

# Input 1
textAreaInput("x", "Enter your string here:", rows = 3),

# Item 2
tags$li("Instructions for Point 2."),

# Input 2
sliderInput("t", "Indicate your desired number of results:", value = 10,
            min = 1, max = 50),

# Item 3
tags$li("Instructions for Point 3."),

# Input 3
selectInput("y", "Pick from list:", ppos)

# Close numbered list
# Close sidebar

# Action button to go
actionButton("button", label = "Do it!")

# Close fluidpage

but the server file doesn't seem to produce anything. Ideally, I'd like the user to hit the "go" button to make the script run and generate output each time.

        function(input, output, session) {

        coolFunction(input$x, input$y, input$t),
        output$finresult <- renderTable(finresult)

I'm sure I've missed something fundamental. Does anyone see it?

1 answer

  • answered 2022-01-23 06:23 Karl Wolfschtagg

    I discovered the answer. It is here:

            function(input, output, session) {
            output$finresult <- renderTable({
                    coolFunction(input$x, input$y, input$t)})

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum