From e44439ae265a7cca2b32b4c6e265b0e005810977 Mon Sep 17 00:00:00 2001 From: Quarto GHA Workflow Runner Date: Fri, 29 Nov 2024 19:42:09 +0000 Subject: [PATCH] Built site for gh-pages --- .nojekyll | 2 +- coc.html | 19 +- content/01-accessing-jupyterhub.html | 19 +- content/01-intro-to-jupyterhub.html | 19 +- content/01-repro-reports.html | 19 +- content/02-git-2.html | 19 +- content/02-git-jupyter.html | 19 +- content/02-git-rstudio.html | 19 +- content/02-git.html | 19 +- content/02-local-setup-python.html | 19 +- content/02-local-setup-r.html | 19 +- content/02-rstudio.html | 19 +- content/index.html | 19 +- index.html | 19 +- schedule.html | 26 +- search.json | 408 +++++++++--------- setup.html | 19 +- ...p-34f0718a046e1c696f050a04181c961f.min.css | 12 + ...k-23c114e9f269a5bcf5260e6b10ff2021.min.css | 12 + site_libs/bootstrap/bootstrap-dark.min.css | 12 - site_libs/bootstrap/bootstrap.min.css | 12 - ...dark-d166b450ba5a8e9f7a0ab969bf6592c1.css} | 2 +- ...ting-e26003cea8cd680ca0c55a263523d882.css} | 2 +- site_libs/quarto-html/quarto.js | 5 +- sitemap.xml | 76 ++-- support.html | 19 +- team.html | 19 +- tutorials/tutorial-1.html | 19 +- tutorials/tutorial-2.html | 19 +- tutorials/tutorial-3.html | 23 +- tutorials/tutorial-4.html | 372 +++++++++++++++- .../figure-html/fig-colname-1.png | Bin 0 -> 15222 bytes tutorials/tutorial-5.html | 19 +- 33 files changed, 877 insertions(+), 448 deletions(-) create mode 100644 site_libs/bootstrap/bootstrap-34f0718a046e1c696f050a04181c961f.min.css create mode 100644 site_libs/bootstrap/bootstrap-dark-23c114e9f269a5bcf5260e6b10ff2021.min.css delete mode 100644 site_libs/bootstrap/bootstrap-dark.min.css delete mode 100644 site_libs/bootstrap/bootstrap.min.css rename site_libs/quarto-html/{quarto-syntax-highlighting-dark.css => quarto-syntax-highlighting-dark-d166b450ba5a8e9f7a0ab969bf6592c1.css} (97%) rename site_libs/quarto-html/{quarto-syntax-highlighting.css => quarto-syntax-highlighting-e26003cea8cd680ca0c55a263523d882.css} (97%) create mode 100644 tutorials/tutorial-4_files/figure-html/fig-colname-1.png diff --git a/.nojekyll b/.nojekyll index f76250f..2c80121 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -3f6aaea5 \ No newline at end of file +388aaefc \ No newline at end of file diff --git a/coc.html b/coc.html index 780cd4e..6eb1917 100644 --- a/coc.html +++ b/coc.html @@ -2,7 +2,7 @@ - + @@ -37,12 +37,12 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + @@ -36,12 +37,12 @@ - - + + - - + + + - - + + - - + + -
+

Cross-references, bibliography and citations in Quarto files

@@ -330,6 +372,7 @@

Cross-references, bibliography and citations in Quarto filesInsert citations and a bibliography into a Quarto document
  • Customize citation and bibliography styles
  • Add cross-referencing for tables, figures, and sections to direct your readers through your document
  • +
  • Make dynamic captions for tables and figures
  • @@ -340,7 +383,302 @@

    Today’s Car
    1. https://carpentries-incubator.github.io/reproducible-publications-quarto/02-quarto/08-biblio-crossref/index.html
    -

    For this week’s tutorials, we will be relying on the forked repository from previous sessions. If you have not yet set up your forked repository in RStudio, follow the instructions here: https://nmfs-opensci.github.io/Quarto-Workshop-2024/tutorials/tutorial-2.html#instructions-for-forking-the-carpentries-example-repository

    +

    We will again be relying on the forked repository from previous sessions. If you have not yet set up your forked repository in RStudio, follow the instructions here: https://nmfs-opensci.github.io/Quarto-Workshop-2024/tutorials/tutorial-2.html#instructions-for-forking-the-carpentries-example-repository

    + +
    +

    Creating Dynamic Captions

    +

    We can create captions for tables and figures that are dynamic based on our code. We will be going through a quick example of how this can be done using knitr. Below are a couple examples that were produced for one of the Quarto teams. Feel free to play around with this with your own variables and datasets.
    +

    +
    +

    Example 1: from a column value

    +

    If the information for our dynamic caption is contained within a column in the dataset (say, a single static column for the species or gear), we can extract the information from the columns of interest. Let’s create a dataset with a constant species and gear.

    +
    +
    # Create a dummy dataset
    +dat <- data.frame(species = rep('Mycteroperca microlepis', 10),
    +                  gear = rep(c('HL','LL','SP','UA'),5),
    +                  age = 1:20,
    +                  size = seq(1,100,5))
    +
    +write.csv(dat, file = 'dat_colval.csv',row.names = F)
    +
    +

    We can make a dynamic label in a few ways. If a caption with a similar format is going to be used multiple times throughout the document, it might be easiest to make this a function. Otherwise, we can just use a standard call to paste (note that paste0 is a special case of paste in which the separator argument is by default '' (no separator).

    +
    +
    # Make dynamic label
    +# read in the data file
    +library(tidyverse)
    +
    +
    ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
    +✔ dplyr     1.1.4     ✔ readr     2.1.5
    +✔ forcats   1.0.0     ✔ stringr   1.5.1
    +✔ ggplot2   3.5.1     ✔ tibble    3.2.1
    +✔ lubridate 1.9.3     ✔ tidyr     1.3.1
    +✔ purrr     1.0.2     
    +── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
    +✖ dplyr::filter() masks stats::filter()
    +✖ dplyr::lag()    masks stats::lag()
    +ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
    +
    +
    dat <- read.csv('dat_colval.csv') %>%
    +  mutate(gear = factor(gear),
    +         gear_name = factor(case_when(gear == 'HL' ~ 'hook and line',
    +                               gear == 'LL' ~ 'longline',
    +                               gear == 'SP' ~ 'spear',
    +                               gear == 'UA' ~ 'unassigned gear code')))
    +  
    +
    +# extract the species name
    +spp <- unique(dat$species)
    +
    +# extract the gear
    +gear <- levels(dat$gear)
    +
    +# extract the gear name
    +gear_name <- levels(dat$gear_name)
    +
    +# paste the gear name and its abbreviation together with the abbreviation inside parentheses
    +gear_caption_string <- paste0(gear_name,' (',gear,')')
    +
    +# paste together the caption
    +cap <- paste0('Age and length of ',
    +             spp,
    +             ' from ',
    +             paste(gear_caption_string[-length(gear_caption_string)],collapse = ', '),
    +             ', and ',
    +             gear_caption_string[length(gear_caption_string)],
    +             '.')
    +cap
    +
    +
    [1] "Age and length of Mycteroperca microlepis from hook and line (HL), longline (LL), spear (SP), and unassigned gear code (UA)."
    +
    +
    +

    We can assign the caption using the #| tbl-cap option in our table code chunk. To input an r variable, we use the following notation:

    +
    #| tbl-cap: !expr cap
    +

    By using !expr we can insert an R variable or even a full expression into the caption. This example inserts the value of the R variable cap into the caption.

    +
    +
    # Make table using kable
    +library(knitr)
    +kable(dat)
    +
    +
    +
    +Table 1: Age and length of Mycteroperca microlepis from hook and line (HL), longline (LL), spear (SP), and unassigned gear code (UA). +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    speciesgearagesizegear_name
    Mycteroperca microlepisHL11hook and line
    Mycteroperca microlepisLL26longline
    Mycteroperca microlepisSP311spear
    Mycteroperca microlepisUA416unassigned gear code
    Mycteroperca microlepisHL521hook and line
    Mycteroperca microlepisLL626longline
    Mycteroperca microlepisSP731spear
    Mycteroperca microlepisUA836unassigned gear code
    Mycteroperca microlepisHL941hook and line
    Mycteroperca microlepisLL1046longline
    Mycteroperca microlepisSP1151spear
    Mycteroperca microlepisUA1256unassigned gear code
    Mycteroperca microlepisHL1361hook and line
    Mycteroperca microlepisLL1466longline
    Mycteroperca microlepisSP1571spear
    Mycteroperca microlepisUA1676unassigned gear code
    Mycteroperca microlepisHL1781hook and line
    Mycteroperca microlepisLL1886longline
    Mycteroperca microlepisSP1991spear
    Mycteroperca microlepisUA2096unassigned gear code
    +
    +
    +
    +
    +
    +
    +
    +

    Example 2: from a column header

    +

    If instead our dynamic information is in a column header, we can use the colnames function to extract the appropriate information. This may be useful if the structure of the data is constant but a value column changes names across datasets. The below example is a bit trivial, but may be useful for certain cases.

    +
    +
    # Create a dummy dataset
    +dat <- data.frame(species = rep('Mycteroperca microlepis', 10),
    +                  SL = 1:10,
    +                  FL = 1:10)
    +
    +write.csv(dat, file = 'dat_colname.csv',row.names = F)
    +
    +
    +
    # Make dynamic label
    +# read in the data file
    +dat <- read.csv('dat_colname.csv')
    +
    +# extract the species name
    +spp <- unique(dat$species)
    +
    +# extract the length types
    +param_1 <- colnames(dat)[2]
    +
    +param_2 <- colnames(dat)[3]
    +
    +# paste together the caption
    +cap <- paste(spp,
    +             param_1,
    +             'vs.',
    +             param_2
    +             )
    +cap
    +
    +
    [1] "Mycteroperca microlepis SL vs. FL"
    +
    +
    +
    +
    # Make plot using ggplot
    +library(ggplot2)
    +ggplot(dat) + geom_point(aes(x = SL, y = FL))
    +
    +
    +
    +
    + +
    +
    +Figure 1: Mycteroperca microlepis SL vs. FL +
    +
    +
    +
    +
    +


    +

    +

    Zotero and Quarto: a Powerful Pairing

    @@ -597,8 +935,6 @@

    Connect Zotero }); clipboard.on('success', onCopySuccess); if (window.document.getElementById('quarto-embedded-source-code-modal')) { - // For code content inside modals, clipBoardJS needs to be initialized with a container option - // TODO: Check when it could be a function (https://github.com/zenorocha/clipboard.js/issues/860) const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', { text: getTextToCopy, container: window.document.getElementById('quarto-embedded-source-code-modal') @@ -709,7 +1045,6 @@

    Connect Zotero if (window.Quarto?.typesetMath) { window.Quarto.typesetMath(note); } - // TODO in 1.5, we should make sure this works without a callout special case if (note.classList.contains("callout")) { return note.outerHTML; } else { @@ -935,6 +1270,15 @@

    Connect Zotero } }); +