Why does output$name in the server does not work.

#|context: server

ds <- reactive( datasets[[input$inDs]] )
output$ui <- renderUI(ds)

Error in output$ui <- renderUI(ds) : object 'output' not found

1 Like

Can you post a minimal reprex that demonstrates the problem?

The original program is created using Shiny on RStudio, and it works very well. Below is the Quarto-Shiny code so far. I am using the format: revealjs and to instantiate the markdown editor I start with ```{r} which becomes just {r}. The back ticks desappear and no backticks are needed to close the markdown block.


title: "Linear Regression"
format: revealjs
editor: visual
profile: shiny
smaller: true
scrollable: true

Introduction

This is a presentation that reads data files and runs an statistical summary and displays a plot to determine the linearity of data in the file. The data files are obtained from the R package "datasets" using the command: output$dat <- renderPrint(data(package = "datasets")$results[ , "Item"]) and manually stored in the variable "datasets".

The user selects a data file from an interactive menu first, and subsequently selects the variables in the data file to run the statistics and the regression on the selected data.

Libraries

#| label: libraries
#| echo: true
suppressWarnings(suppressMessages(library(shinylive)))
suppressWarnings(suppressMessages(library(shiny)))
suppressMessages(suppressWarnings(library(rmarkdown)))
suppressMessages(suppressWarnings(library(dplyr)))
suppressMessages(suppressWarnings(library(bslib)))

Data Sets

#| label: data
#| echo: true
#| message: true
#| warning: true

datasets <- list(Formaldehyde = Formaldehyde, Indometh = Indometh, 
                 LifeCycleSavings = LifeCycleSavings, OrchardSprays = OrchardSprays,                  Theoph = Theoph, chickwts = chickwts,faithful = faithful,                           randu = randu,ChickWeight = ChickWeight, Loblolly = Loblolly,                       anscombe = anscombe, beaver1 = beaver1, nottem = nottem,
                 stackloss = stackloss, swiss = swiss, DNase = DNase,
                 Nile = Nile, mtcars = mtcars, trees = trees)

UI

#| label: selectinput
#| echo: true
#| message: true
#| warning: true
  
  titlePanel(tags$h2("DATA SETS", style =    "color: blue;"))
  radioButtons("inDs", "Select dataset:", choices = names(datasets))
  uiOutput("ui")

#server

#|context: server

ds <- reactive( datasets[[input$inDs]] )
output$ui <- renderUI(ds)

##Error in output$ui <- renderUI(ds) : object 'output' not found

UI

varSelectInput("inVar", "Select variable:", datasets[[1]])
varSelectInput("inVar1", "Select a second variable:", datasets[[1]])

SERVER

#| warning: true
observe(updateVarSelectInput(session, "inVar", data = ds()))
observe(updateVarSelectInput(session, "inVar1", data = ds()))
1 Like

You need to use server: shiny not profile: shiny.

1 Like

Thank you: The error does not show up now.

1 Like

When I use server:shiny instead of profile:shiny in the header, the previous error does not show, but the program does not run and I get a different error:
==> quarto serve Linear.qmd --presentation

ERROR: Unknown option "--presentation". Did you mean option "--profile"?
Also, the button RENDER desappears and is replaced with the button RUN DOCUMENT.

1 Like

You can't render a quarto document with shiny outputs in - it needs to be running like an app to function. That's why the buttons change. I am not sure why -- presentation is being appended to the quarto call. When I have run shiny inside a revealjs, I just click 'Run Document' and everything works.

1 Like

Thank you. How do I embed the app into the quarto presentation?

1 Like