Miscellaneous tips and tricks learnt from conference

Use of AI

Prompt engineering

  • Use single detailed prompts “built” layer by layer.
    • Approach like designing a ggplot: Start with a plot, then layer aesthetics, geometries, facets, and limits.
  • Refer to links to help it along if you already know something about the subject, you are asking about
  • For data storytelling: Give context such as “You are a data scientist who does a great job of explaining various outputs from data analysis and modeling, including numbers, tables, and plots, to help a more general audience understand your results better. Other details of model and what an inputted plot shows. Stick to only the data and information provided in creating your response. Your response should be understandable by a non-technical audience, 100 word or fewer, and in English.

DuckDB

See the notes from keynote Data Wrangling [for Python or R] Like a Boss With DuckDB, most specifically the section about duckplyr.

Positron

  • Documentation on hover
  • Use Poistron to debug C and C++
  • Ctrl+shift+P opens command palette
  • “Enable Rstudio key mappings in Positron” setting available
  • Extensions readily available from Open VSX

Quarto

See also What’s new - Quarto.

Tips working in Quarto

  • Use quarto preview in terminal to open a tab that will update live when making changes to files.
    • Configure which file changes should trigger a re-rendering by using fx. preview: watch: - "*.qmd" in the _quarto.yml file.
  • Use of callouts
    • Create custom classes by doing ::: {.new_class} ... ::: and defining the class in the .scss file like .new_class { ... }
  • Use Quarto listings to create overviews of the available files in a directory
  • Use params: at in YAML at top or documents and then reference them using params$
  • Use embed to include figures, code or anything else in code chunks from other quarto documents or Jupyter notebooks
    • Fx. if analyses are performed which are to be used inside both an article and a slide show, save the analyses in an analyses/ folder and just embed them from there in your other documents. Means there is one source of truth
  • Can ctrl+V images in visual mode

Formats

Use templates!

Publishing

  • Use existing GitHub actions
  • Use pre-render and post-render specified under project in your _quarto.yml file to run code prior to or after rendering the site
    • Can fx. use post-render to run an R script that uses rsync to “move” the _site folder to a server location for deployment

Customisation

  • Use CSS and javascript for customisation
    • Mozilla web docs for help with fx. CSS
    • Use AI to help write CSS and javascript
    • Use DevTools via right-click -> inspect to look at the HTML
      • Make changes to see how it affects the website
      • Can be used on resulting HTMLs from rendering of quarto to help see structure and aid in writing of CSS to style
      • See how other people’s websites are structured
  • Include .scss files in theme
    • Use layer boundaries (/*-- scss:defaults --*/, /*-- scss:rules --*/, /*-- scss:mixins --*/, /*-- scss:functions --*/, or /*-- scss:uses --*/)
      • Use /*-- scss:defaults --*/ to define variables that can be referenced in the rules - like fx. colors

Miscellaneous other quarto notes

GitHub actions

See notes about GitHub actions from workshop with notes on fx.

General package development

Tip

See workshop notes Practical tips for working on production projects for nice practical tips on how to manage time, collaborate, tips on ensuring consistent high quality code as well as tips for package development in production

Other

API usage

Computational statistics

Think of computational statistics as way of having only one test contrary to theoretical statistic, where need to think about what is the “right” distribution or test

Misc ressources

Back to top