This program displas a list of radio buttons. When a radio button that has the name of the data set is pressed, the data set is selected. The code is supposed to update a dropdown menu with the variable names of the data set. If a different data set were selected from the list of radio buttons, the dropdown menu would be updated and would display the variables of the newly selected data set.
In the program below, the drop down menu does not get updated with the variable names of the newly selected data set. I am using the latest Quarto version quarto -1.9.37 - win. The original program is created using Shiny with RStudio, and it works very well, b ut it does not work with quarto. 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.
Finally. When I use server:shiny instead of profile shiny, the program does not run and I get the error ERROR: Unknown option "--presentation". Did you mean option "--profile"? and the RENDER button is replaced by the RUN DOCUMENT button.
title: "Linear Regression"
format: revealjs
editor: visual
server: 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")
#|context: server
ds <- reactive( datasets[[input$inDs]] )
output$ui <- renderUI(ds)
UI
varSelectInput("inVar", "Select variable:", datasets[[1]])
varSelectInput("inVar1", "Select a second variable:", datasets[[1]])
SERVER
#| context: server
#| warning: true
observe(updateVarSelectInput(session, "inVar", data = ds()))
observe(updateVarSelectInput(session, "inVar1", data = ds()))