Skip to content

Commit a746f9b

Browse files
authored
Update Chapter_04.md (#111)
* Update Chapter_04.md Fix exercise & lists in Chapter 4 * Update chapter_02.md Change link to analysis.R from relative (which downloads the file) to absolute (on GitHub) * Update chapter_05.md Change the links to scripts to within repo
1 parent 6150a87 commit a746f9b

3 files changed

Lines changed: 28 additions & 37 deletions

File tree

docs/chapters/Chapter_04.md

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ cancer_data$diagnosis <- as.factor(cancer_data$diagnosis)
8282
*Figure A: An example of a Quarto document in RStudio, showcasing integrated code and results.*
8383

8484
To start creating your own Quarto document in RStudio:
85-
1. Go to **File > New File > Quarto Document...**.
85+
86+
1. Go to **File > New File > Quarto Document...**.
8687
2. Follow the prompts in the wizard to configure your document, choosing from a variety of templates and settings to suit your project's needs.
8788

8889
#### YAML Header (Metadata)
@@ -116,31 +117,19 @@ This header sets up the document with a title, an author, specifies that code ec
116117

117118
**FIGURE:** ![Insert a screenshot of the "Render" button here.]
118119

119-
<details>
120-
<summary><strong>📝 Exercise: Produce your own Quarto document</strong></summary>
121-
<p>
120+
!!! question "Excercise: Produce your own Quarto document"
122121

123-
1. Create a new Quarto document in your editor (e.g., RStudio).
124-
2. Add a title and your name as the author in the YAML header.
125-
3. Set the output format to HTML.
126-
4. Render the document.
122+
1. Create a new Quarto document in your editor (e.g., RStudio).
123+
2. Add a title and your name as the author in the YAML header.
124+
3. Set the output format to HTML.
125+
4. Render the document.
127126

128-
</p>
129-
</details>
127+
??? success "Solution"
130128

131-
<details>
132-
<summary><strong>✅ Solution:</strong></summary>
133-
<p>
134-
135-
1. **Create Document**: In RStudio, use `File > New File > Quarto Document`.
136-
2. **Edit YAML Header**: Add `title: "Your Title"` and `author: "Your Name"`.
137-
3. **Set Output**: Ensure the YAML includes `format: html`.
138-
4. **Render**: Click the "Render" button to produce your HTML document.
139-
140-
*Insert screenshots demonstrating each step for clarity.*
141-
142-
</p>
143-
</details>
129+
1. **Create Document**: In RStudio, use `File > New File > Quarto Document`.
130+
2. **Edit YAML Header**: Add `title: "Your Title"` and `author: "Your Name"`.
131+
3. **Set Output**: Ensure the YAML includes `format: html`.
132+
4. **Render**: Click the "Render" button to produce your HTML document.Here are some potential problems we can think of (you may have similar):
144133

145134

146135
*Insert screenshots demonstrating each step for clarity.*
@@ -416,15 +405,16 @@ In this section, we'll dive into hands-on exercises to apply what we've learned
416405
**Objective**: Set up the YAML header for your document titled "Breast Cancer Data Analysis".
417406

418407
**Instructions**:
419-
1. Title the document "Breast Cancer Data Analysis."
420-
2. Specify the author as your research team's name.
421-
3. Include a bibliography file named "references.bib."
422-
4. Make sure the document includes the current date.
423-
5. Enable a table of contents.
424-
6. Number the sections.
425-
7. Use the Pygments highlight style for code.
426-
8. Hide code echo during execution.
427-
9. For HTML output, enable code folding, code tools, and paged data frame printing.
408+
409+
1. Title the document "Breast Cancer Data Analysis."
410+
2. Specify the author as your research team's name.
411+
3. Include a bibliography file named "references.bib."
412+
4. Make sure the document includes the current date.
413+
5. Enable a table of contents.
414+
6. Number the sections.
415+
7. Use the Pygments highlight style for code.
416+
8. Hide code echo during execution.
417+
9. For HTML output, enable code folding, code tools, and paged data frame printing.
428418
10. Indicate a preference for the visual editor.
429419

430420
<details>
@@ -450,6 +440,7 @@ editor: visual
450440
```
451441
452442
**Figure 2**: Example of how the Quarto HTML document head looks.
443+
453444
![Quarto HTML Document Head](./Figure_CodRep/CodeRep1.png)
454445
455446
</p>

docs/chapters/chapter_02.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Now, it is common that the analysis changes direction as you go along, and/or th
5757
If you feel dissatisfied with this workflow, you will benefit from this training programme. You will be able to adopt a more efficient workflow that not only generates a deliverable with reproducible results, but also keeps track of the versions of the files so there won't be anything like `presentation-final-final-02.pdf`.
5858

5959
## 2.3 Literate Programming
60-
Practically, literate programming (almost) means merging the **.R** and .tex files in the old workflow. Let's start with a snippet of a non-literate-programming R script (you can access the full script [here](../scripts/analysis.R)):
60+
Practically, literate programming (almost) means merging the **.R** and .tex files in the old workflow. Let's start with a snippet of a non-literate-programming R script (you can access the full script [here](https://github.com/elixir-europe-training/ELIXIR-TrP-LiterateProgrammingR-CodeRep/blob/main/docs/scripts/analysis.R)):
6161

6262
```
6363
cancer_data <- read.csv("data/breast-cancer-wisconsin.csv") # load the data

docs/chapters/chapter_05.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ It is time for a more comprehensive rounding-off exercise to bring it all togeth
1111

1212
!!! question "Exercise"
1313

14-
Return to our original example of [non-LP script](https://github.com/clement-lee/coderep/blob/master/wisconsin.R) (#81: do we need to introduce this in chapter?) and rework it into a full fledged literate programming
14+
Return to our original example of [non-LP script](https://github.com/elixir-europe-training/ELIXIR-TrP-LiterateProgrammingR-CodeRep/blob/main/docs/scripts/analysis.R) and rework it into a full fledged literate programming
1515
document by applying uour knowledge of markdown and quarto to transform the original script into an LP HTML or PDF document (Fig. 5.1).
1616

1717
Specifically:
1818

19-
1. Obtain the [Wisconsin.R](https://github.com/clement-lee/coderep/blob/master/wisconsin.R) script, copy the script into a new empty script in your RStudio environment
19+
1. Obtain the [analysis.R](https://github.com/elixir-europe-training/ELIXIR-TrP-LiterateProgrammingR-CodeRep/blob/main/docs/scripts/analysis.R) script, copy the script into a new empty script in your RStudio environment
2020
2. Convert the script into a .Qmd or .Rmd document, with explanatory text and code chunks for plain code and plots
2121
3. Knit your final .Qmd or .Rmd file to a PDF (or HTML) document
2222

2323
??? success "Solution"
2424

25-
There are no right or wrong answers here but certain solutions will definitely be better than others. if you get stuck or need inspiration check out one possible solution [here](https://github.com/clement-lee/coderep/blob/master/wisconsin.Rmd)
25+
There are no right or wrong answers here but certain solutions will definitely be better than others. if you get stuck or need inspiration check out one possible solution [here](https://github.com/elixir-europe-training/ELIXIR-TrP-LiterateProgrammingR-CodeRep/blob/main/docs/scripts/wisconsin.Rmd)
2626

2727
<figure>
28-
<img src="../../assets/images/RtoQmdtoPDF.png" width="600" alt="Image showing path from .R to .Rmd to .pdf"/>
28+
<img src="../../assets/images/RtoQmdtoPDF.png" width="720" alt="Image showing path from .R to .Rmd to .pdf"/>
2929
<figcaption> Figure 5.1 Going from the script (Winconsin.R) to a Qmd (or Rmd) file that can be knitted into a LP PDF or similar LP document. </figcaption>
3030
</figure>
3131

0 commit comments

Comments
 (0)