Exciting things I learned at rstudio::conf(2022)

Quarto

```{r}
!4 %in% c(4, 5, 1)
```
[1] FALSE
```{julia}
4 ∉ [4, 5, 1]
```
false
```{python}
4 not in [4, 5, 1]
```
False

Unification

  • Languages

    quarto preview notebook.ipynb --to pdf
    quarto convert notebook.ipynb # to .qmd
  • Platforms quarto-unify

Simplification

  • Flexible engines: Knitr, Jupyter, and Observable
  • Easy transition: .Rmd → .qmd
  • RStudio IDE Visual Editor
    • Easy editing/formatting of Markdown tables
    • Copy/paste from Google docs
    • Citation (Allaire 2022)
    • Insert anything: ⌘/

The Posit future

  • Carlos Rios will need to change all of his RSConnect, Workbench, Package Manager slides 😈
  • More features for Python, Julia, etc.
  • Terrible puns: positive, deposit 🤦🏽

New ways to build Shiny apps

shinytest2: game changer!

  • record_test()
test_that("{shinytest2} recording: simple-app", {
  app <- AppDriver$new(name = "simple-app", height = 407, width = 348)
  app$set_inputs(name = "Barret")
  app$click("greet")
  app$expect_values()
})
  • app$view()

  • shiny::exportTestValue()

Other neat talks

Package development masterclass

  • Tests: test code != regular code
    • everything inside a testthat() chunk
  • Documentation: useful != exactly correct
    • @param x,y
    • @keywords internal

Write better error messages

  • Consistent
  • Transparent: type, value
  • Relevant: which function failed, for which argument
  • Exhaustive: contextual information, external resources
  • Concise: avoid paragraphs of text
  • expect_snapshot()

Error bullets

cli::cli_abort(c(
  "My error message.",
  "*" = "Bullet",
  "i" = "Info bullet",
  "x" = "Cross bullet",
  "v" = "Check bullet"
))
Error:
! My error message.
• Bullet
ℹ Info bullet
✖ Cross bullet
✔ Check bullet

Function design

  • rlang::arg_match(): more about argument than match, autocomplete, etc.

  • cli_inform()

Other workshops

References

Allaire, JJ. 2022. “Quarto: R Interface to ’Quarto’ Markdown Publishing System.” https://CRAN.R-project.org/package=quarto.

Thank you!