Skip to content

review_syntax#1

Open
PierreWal wants to merge 1 commit intomainfrom
review_pw
Open

review_syntax#1
PierreWal wants to merge 1 commit intomainfrom
review_pw

Conversation

@PierreWal
Copy link

@PierreWal PierreWal commented Feb 24, 2026

Hi Placide,

I am copying here the same comments as I left in Teams.

I edited your original documents and made a few suggestions.

  1. Using an inactive code chunk (#| eval: false) followed by ::: {.callout-note collapse="true"} and active code chunk with #| echo: false, and then ::: to close the callout-note allows for the output of the code to be only visible when clicking on the the header (see syntax for more detail). I did this for about one half of the code chunks - feel free to expand if you feel this meets your needs. In my view this is the most user-friendly option.

  2. Alternatively you can simply have all the code chunks being inactive using exec=F in _quarto.yml (no need to repeat it in the code chunks), but that defeats a little bit the purpose of having a dynamic document. You could simply provide a download link to a pure R syntax file, without formatting it in Quarto

  3. I also made a couple of suggestions to shorten/simplify the R code. Feel free to adopt them or not if you don't find them useful. The most important ones::

  • the datasets imported into R with read_spss() or read_dta include variable labels and value labels as attributes. If you use haven::as_factor(), this will convert any numeric categorical variable as a factor with the correct factor levels. Therefore there is no need to manually redefine all the value labels.
  • I reproduced some of the pie charts using pie() from base R. It does not look as nice as the ggplot version, but is much simpler and shorter to implement.
  • We do not have a plot policy at UKDS, but it is often considered that pie charts are potentially confusing as people are not very good at deducing the size of the slices from the angle in the pie. Bar charts are easier to read and to implement.

I hope this helps
P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants