rshinyquarto

Error in `if (xfun::is_blank(options$code)) ...`: ! the condition has length > 1


I would like to write a blog using Quarto and add a Shiny app. But when I try to run a simple shiny example app like from the quarto website, I get an error. Here is some reproducible code from an .qmd file like the example from link above:

---
title: "Old Faithful"
format: html
server: shiny
---

```{r}
sliderInput("bins", "Number of bins:", 
            min = 1, max = 50, value = 30)
plotOutput("distPlot")
```

```{r}
#| context: server
output$distPlot <- renderPlot({
  x <- faithful[, 2]  # Old Faithful Geyser data
  bins <- seq(min(x), max(x), length.out = input$bins + 1)
  hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
```

Output error:

processing file: test.qmd
  |....................................................| 100% [unnamed-chunk-2]
Quitting from lines 14-20 [unnamed-chunk-2] (test.qmd)
Error in `if (xfun::is_blank(options$code)) ...`:
! the condition has length > 1
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
  9. knitr:::process_group.block(group)
 10. knitr:::call_block(x)
 12. rmarkdown (local) hook(params)
                                                                                                            
Execution halted

Adding a setup chunk with shiny package also doesn't work:

```{r}
#| context: setup
library(shiny)
```

So even running the exact same code as from the site returns in an error which I'm not sure how to solve. So I was wondering if anyone knows why this error happens and how to fix it?


I am using the following quarto version:

quarto --version
1.3.276

Solution

  • After installing the latest version of the rmarkdown v2.10 package, the error was solved using this:

    install.packages("rmarkdown")
    library(rmarkdown)