rstudio / rstudio/flexdashboard

Notes are silently dropped if a no-output producing chunk is inserted

Open
#447 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
848
Forks
298
PR merge metrics
No merged PRs in 30d

Description

Disclaimer

I previously asked this question on SO to check whether this behavior is maybe intentional and got a workaround as a solution, but I am still not sure whether this behavior is really intentional.

Problem

When adding a chunk, which produces no output (for example to close a database connection), after a chunk with notes, the notes ( added via >) disappear.

Reprex

---
title: "Clean Up Chunk is Bad"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
---

```{r}
library(plotly)
```

## Row

### A Chart

```{r chart-chunk}
plot_ly(x = 1, y = 10, type = "bar")
```
> Text not shown if chunk `clean-up-chunk` is added after this chunk

```{r clean-up-chunk}
### Remove (or not include) this chunk altogether to make the note re-appear again
### Usage: for example to close a db connection
## dbDisconnect(con)
``` 

The text is by the way in the final HTML but not rendered properly:

image

Workaround is to add include = FALSE to clean-up-chunk.

Session Info
─ Session info ────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.2 (2022-10-31 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       RStudio
 language EN
 collate  German_Germany.utf8
 ctype    German_Germany.utf8
 tz       Europe/Berlin
 date     2024-02-16
 rstudio  2023.03.0+386 Cherry Blossom (desktop)
 pandoc   2.19.2 @ C:\\Users\\tthaler\\AppData\\Local\\Programs\\RStudio\\RESOUR~1\\app\\bin\\quarto\\bin\\tools\\pandoc.exe

─ Packages ────────────────────────────────────────────────────────────────────────────────────────
 package       * version date (UTC) lib source
 bslib           0.6.1   2023-11-28 [1] CRAN (R 4.2.3)
 cachem          1.0.8   2023-05-01 [1] CRAN (R 4.2.3)
 cli             3.6.2   2023-12-11 [1] CRAN (R 4.2.3)
 digest          0.6.34  2024-01-11 [1] CRAN (R 4.2.3)
 evaluate        0.23    2023-11-01 [1] CRAN (R 4.2.3)
 fastmap         1.1.1   2023-02-24 [1] CRAN (R 4.2.3)
 flexdashboard * 0.6.2   2023-08-11 [1] CRAN (R 4.2.3)
 htmltools       0.5.7   2023-11-03 [1] CRAN (R 4.2.3)
 jquerylib       0.1.4   2021-04-26 [1] CRAN (R 4.2.2)
 jsonlite        1.8.8   2023-12-04 [1] CRAN (R 4.2.3)
 knitr         * 1.45    2023-10-30 [1] CRAN (R 4.2.3)
 lifecycle       1.0.4   2023-11-07 [1] CRAN (R 4.2.3)
 R6              2.5.1   2021-08-19 [1] CRAN (R 4.2.2)
 rlang           1.1.3   2024-01-10 [1] CRAN (R 4.2.3)
 rmarkdown     * 2.25    2023-09-18 [1] CRAN (R 4.2.3)
 rstudioapi      0.15.0  2023-07-07 [1] CRAN (R 4.2.3)
 sass            0.4.8   2023-12-06 [1] CRAN (R 4.2.3)
 sessioninfo     1.2.2   2021-12-06 [1] CRAN (R 4.2.2)
 systemfonts     1.0.5   2023-10-09 [1] CRAN (R 4.2.3)
 xfun            0.41    2023-11-01 [1] CRAN (R 4.2.3)
───────────────────────────────────────────────────────────────────────────────────────────────────

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reprex in the issue and render it twice: once with only the chart chunk and once with the no-output clean-up chunk added. Compare the generated HTML and rendered dashboard, then trace how notes after a chart are handled when the following chunk produces no output. Done means the note renders in both cases while the clean-up chunk remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.