Skip to content

Commit d9b89c2

Browse files
committed
varia
1 parent 87d5148 commit d9b89c2

File tree

6 files changed

+1124
-143
lines changed

6 files changed

+1124
-143
lines changed

teach/stats/r4a/2025/index-part1.qmd

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: "Authoring, writing and publishing with<br>R Markdown - part 1"
2+
title: "Authoring, writing and publishing with R Markdown"
3+
subtitle: "part 1: Basics and Markdown syntax"
34
author: "Thomas Huet, University of Oxford, CNRS-IRAMAT "
45
title-slide-attributes:
56
data-background-image: "https://raw.githubusercontent.com/zoometh/thomashuet/master/teach/www/logo.png"

teach/stats/r4a/2025/index-part2.qmd

+37-30
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Authoring, writing and publishing with R Markdown"
3-
subtitle: "part 2: code and YAML header"
3+
subtitle: "part 2: Advanced R and YAML code integration"
44
author: "Thomas Huet, University of Oxford, CNRS-IRAMAT"
55
title-slide-attributes:
66
data-background-image: "https://raw.githubusercontent.com/zoometh/thomashuet/master/teach/www/logo.png"
@@ -22,7 +22,7 @@ format:
2222
preview-links: auto
2323
reference-location: document
2424
footnotes-hover: true
25-
logo: https://raw.githubusercontent.com/zoometh/thomashuet/master/teach/www/inst-uni-oxford_.png
25+
logo: https://raw.githubusercontent.com/zoometh/thomashuet/master/img/inst-uni-oxford_cnrs-iramat.png
2626
# css: ../styles.css
2727
# css: https://zoometh.github.io/thomashuet/teach/stats/r4a/styles.css
2828
css: https://zoometh.github.io/thomashuet/css/quarto.css
@@ -33,6 +33,7 @@ pagetitle: "Report with R Markdown - part 2"
3333
footer: "Report with R Markdown - R4Rchaeologists <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/teach/www/logo.png' style='height: 35px;vertical-align: middle;'> Università di Pisa, Jan 2025 - <em>presented by </em> Thomas Huet"
3434
---
3535

36+
# Code chunks
3637

3738
## Code chunks {#chunks}
3839

@@ -172,11 +173,11 @@ knitr::opts_chunk$set(echo = TRUE)
172173
<tbody>
173174
<tr>
174175
<td>`include = FALSE`</td>
175-
<td>prevents `code` and `results` from appearing in the rendered file. R Markdown still runs the code in the chunk, and the results can be used by other chunks.</td>
176+
<td>prevents `code` and `output` from appearing in the rendered file. R Markdown still runs the code in the chunk, and the output can be used by other chunks.</td>
176177
</tr>
177178
<tr>
178179
<td>`echo = FALSE`</td>
179-
<td>prevents `code`, but not the results from appearing in the rendered file.</td>
180+
<td>prevents `code`, but not the output, from appearing in the rendered file.</td>
180181
</tr>
181182
<tr>
182183
<td>`message = FALSE`</td>
@@ -196,7 +197,7 @@ knitr::opts_chunk$set(echo = TRUE)
196197
<div class="div-code">
197198
<small>code chunk</small>
198199
```{.r }
199-
{r munsingenspat, fig.height = 10, fig.with = 10}
200+
{r munsingenspat, fig.cap = "my caption", fig.height = 10, fig.with = 10}
200201
```
201202
</div>
202203

@@ -212,7 +213,7 @@ knitr::opts_chunk$set(echo = TRUE)
212213
<tbody>
213214
<tr>
214215
<td>`fig.cap = "..."`</td>
215-
<td> adds a caption to graphical results.</td>
216+
<td> adds a caption to graphical output.</td>
216217
</tr>
217218
<tr>
218219
<td>`fig.height = 7`</td>
@@ -281,6 +282,8 @@ knitr::include_graphics(fibula)
281282

282283
\
283284

285+
# YAML
286+
284287

285288
## YAML {#yaml}
286289

@@ -304,7 +307,7 @@ date: '2023-02-05'
304307

305308
\
306309

307-
## YAML dates
310+
## Dates
308311

309312
<div class="div-yaml">
310313
<small>header YAML</small>
@@ -338,7 +341,7 @@ Here the <notes>`</notes> quote has been changed to a <notes>'</notes> quote for
338341
:::
339342
\
340343

341-
## YAML output
344+
## Output
342345

343346
<span class="r-md">R Markdown</span> output format.
344347

@@ -354,14 +357,14 @@ output:
354357
```
355358
</div>
356359

357-
Here a PDF: <small><https://github.com/zoometh/thomashuet/blob/main/teach/stats/r4a/2025/temp.pdf></small>
360+
<small>Here a PDF: <https://github.com/zoometh/thomashuet/blob/main/teach/stats/r4a/2025/temp.pdf></small>
358361

359362
```{=html}
360363
<script src="https://gist.github.com/zoometh/d1b4945d1c16f853a7888ede03c4807d.js"></script>
361364
```
362365

363366

364-
## YAML table of content
367+
## Table of content
365368

366369
Table of content (TOC).
367370

@@ -384,7 +387,7 @@ output:
384387

385388

386389

387-
## YAML references
390+
## References
388391

389392
Locate the bibliographic file (e.g. [`references.bib`](https://github.com/zoometh/thomashuet/blob/main/teach/stats/r4a/2025/references.bib)).
390393

@@ -411,6 +414,9 @@ see [Xie <em>et al.</em>](https://bookdown.org/yihui/rmarkdown/html-document.htm
411414

412415
\
413416

417+
# More HTML
418+
419+
414420
## Styling
415421

416422
::: {.panel-tabset}
@@ -544,6 +550,9 @@ Customize with CSS like this <notes>**dodgerblue** background</notes>.
544550

545551
:::
546552

553+
# Advanced publishing
554+
555+
547556
## Interactivity
548557

549558
::: {.panel-tabset}
@@ -560,7 +569,7 @@ runtime: shiny
560569
</div>
561570
562571
::: {.callout-note}
563-
Try: `File > New File > Rmarkdown > Shiny`, or in the <span class="r-yaml">YAML header</span>. There are different ways to use <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/app-prg-r-pkg-shiny.png' style='height: 45px;vertical-align: middle;'> in <span class="r-md">R Markdown</span>, for example by embedding an <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/app-prg-html.png' style='height: 45px;vertical-align: middle;'> widget created by Shiny outside the R Markdown document, or by embedding the Shiny coding directly.
572+
Try: `File > New File > Rmarkdown > Shiny`, or in the <span class="r-yaml">YAML header</span>. There are different ways to use <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/r-pkg-shiny.png' style='height: 45px;vertical-align: middle;'> in <span class="r-md">R Markdown</span>, for example by embedding an <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/app-prg-html.png' style='height: 45px;vertical-align: middle;'> widget created by Shiny outside the R Markdown document, or by embedding the Shiny coding directly.
564573
:::
565574
\
566575

@@ -645,6 +654,10 @@ output: html_document
645654

646655
## PDF
647656

657+
::: {.panel-tabset}
658+
659+
### Basic
660+
648661
<div class="div-yaml">
649662
<small>header YAML</small>
650663
```{.md code-line-numbers="4"}
@@ -658,9 +671,10 @@ output: pdf_document
658671

659672

660673
::: {.callout-note}
661-
For advanced editing, read below ⬇
674+
For advanced editing, read the other tab panel ️➡
662675
:::
663676

677+
### Advanced
664678

665679
<img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/r-pkg-bookdown.png' style='height: 70px;vertical-align: middle;'> is useful in <span class="r-md">R Markdown</span> for chunk calls, and more generally for cross-referencing. <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/app-pao-adobe-pdf.png' style='height: 45px;vertical-align: middle;'> uses <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/app-pao-latex.png' style='height: 45px;vertical-align: middle;'> syntax, if you don't have [MiKTeX](https://miktex.org/) installed, you need to install the <img src="https://raw.githubusercontent.com/zoometh/thomashuet/master/img/r-pkg-tinytex.png" style="height: 70px;vertical-align: middle;"/> package [@Xie19].
666680

@@ -698,6 +712,8 @@ These temporary files are creates:
698712

699713
At the end of the rendering, these files are deleted.
700714

715+
:::
716+
701717
\
702718

703719
## LaTeX
@@ -729,7 +745,7 @@ On <img src="https://raw.githubusercontent.com/zoometh/thomashuet/master/img/app
729745

730746

731747
```{=html}
732-
<iframe width="1000" height="400" src="https://rpubs.com/"></iframe>
748+
<iframe width="1000" height="300" src="https://rpubs.com/"></iframe>
733749
```
734750
<small><https://rpubs.com/></small>
735751

@@ -776,16 +792,12 @@ On GitHub <img src="https://raw.githubusercontent.com/zoometh/thomashuet/master/
776792

777793
### Objective
778794

779-
<small>
780-
781795
Use <span class="r-md">R Markdown</span> (<span class="r-code">code chunks</span> and <span class="r-text">narrative parts</span>) to create a report. Choose between:
782796

783-
- [ ] improve the `.Rmd` document: "Münsingen-Rain necropolis (Bern, Switzerland). A quantative study of Late Iron Age fibulae" <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/teach/www/munsingen_fib_measures.png' style='height: 65px;vertical-align: middle;'> using the dataset 'Fibulae' from {`archdata`}
797+
- [ ] improve the `.Rmd` document: "*Münsingen-Rain necropolis (Bern, Switzerland). A quantative study of Late Iron Age fibulae*" using the dataset 'Fibulae' from {`archdata`}
784798

785799
- [ ] start from scratch ([here](https://zoometh.github.io/thomashuet/teach/stats/r4a/2025/site/index-part1#/new-document)) and select another dataset from {`archdata`} (e.g. 'Handaxes').
786800

787-
</small>
788-
789801
::: {.callout-note}
790802
The practical part has an estimated duration of 60 minutes
791803
:::
@@ -794,30 +806,25 @@ The practical part has an estimated duration of 60 minutes
794806

795807
### How to start?
796808

797-
<small>Download/Copy the folder `r4a/2025/practice/` and locate the file `2_Rmarkdown_Practice.Rmd` and the .`bib` file by following this link: </small>
809+
1. Download/Copy the folder `r4a/2025/practice/` and locate the file `2_Rmarkdown_Practice.Rmd` and the .`bib` file by following this link:
798810

799811
```{.html}
800812
https://github.com/zoometh/thomashuet/tree/main/teach/stats/r4a/2025/practice/
801813
```
802814

803-
<small> You can also use this website to download the folder: </small>
815+
2. install the {`bookdown`} package
804816

805-
```{=html}
806-
<iframe width="1000" height="200" src="https://download-directory.github.io/"></iframe>
817+
```{.r}
818+
install.packages("bookdown")
807819
```
808-
<small><https://download-directory.github.io/></small>
809-
810-
\
811-
\
812-
813820

814-
### How to end?
821+
### How to finish?
815822

816823
Contact me, send me your `.Rmd` and related files (e.g. `references.bib`) here online 👋
817824

818825
<center>or</center>
819826

820-
<img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/app-github.png' style='height: 50px;vertical-align: middle;'> <https://github.com/zoometh/thomashuet/issues/2>
827+
Write a <img src='https://raw.githubusercontent.com/zoometh/thomashuet/master/img/app-github.png' style='height: 50px;vertical-align: middle;'> issue: <https://github.com/zoometh/thomashuet/issues/2>
821828

822829

823830

0 commit comments

Comments
 (0)