MATH/COSC 3570 Introduction to Data Science
![]()


.qmd) to

![]()




To generate a PDF report, you prefer writing this with 24 lines…


Or this with 250 lines!?



Markdown Text
02-Quarto File
Go to your GitHub repo lab-yourusername. Clone it to your Posit Cloud as a project in 2026-spring-math-3570 workspace.
Open the file lab.qmd.
Change author in YAML.
Click on
or Ctrl/Cmd + Shift + K to produce a HTML document.
How can we show the current date every time we compile the file? [Hint:] Check your hw01. Compile your document and make sure the date shows up.
How do we fold the code so that the document is shorter? Describe it in ## Lab 2: Quarto
Once done, commit with message “02-quarto” and push it to GitHub.
| Markdown Syntax | Output |
|---|---|
|
italics and bold |
|
superscript2 / subscript2 |
|
|
|
verbatim code |
|
|
| Markdown Syntax | Output |
|---|---|
|
Header 1 |
|
Header 2 |
|
Header 3 |
|
Header 4 |
|
Header 5 |
|
Header 6 |
| Markdown Syntax | Output |
|---|---|
|
|
|
|
|
|
Markdown syntax
<https://www.google.com >
[Google link](https://www.google.com)
Output
inline-math: \(A = r^{2}\)
math-block: \[A = r^{2}\]
https://www.google.com
Google link
| Right | Left | Default | Center |
|------:|:-----|---------|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
| Right | Left | Default | Center |
|---|---|---|---|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
Source Mode

Visual Mode (What You See Is What You Mean (WYSIWYM))

03-Markdown
Back to your lab.qmd. In ## Lab 3: Markdown section,
Add a self-introduction paragraph containing a header, bold and italic text.
Add another paragraph that contains
Once done, commit with message “03-markdown” and push it to GitHub.
Has 3x backticks ``` on each end
To insert a code chunk,

Alt + Ctrl + I (Win) ; Option + Cmd + I (Mac)
Indicate engine r, python between curly braces { }
Place options behind the #| (hashpipe): #| option: value
Tools > Modify Keyboard Shortcuts > Filter… > Insert Chunk Python > Option + Cmd + P (or any key binding you like)
echo and eval
By default, the code in the code chunk will be shown in the rendered document and evaluated, and the output will be printed as well.
echo: false would instead hide the code but still evaluate it.
2
What should we do if we want to show the code but not evaluate it?
| Option | Run code | Show code | Output | Plots | Messages | Warnings |
|---|---|---|---|---|---|---|
eval: false |
❌ | ❌ | ❌ | ❌ | ❌ | |
include: false |
❌ | ❌ | ❌ | ❌ | ❌ | |
echo: false |
❌ | |||||
results: "hide" |
❌ | |||||
fig-show: "hide" |
❌ | |||||
message: false |
❌ | |||||
warning: false |
❌ |
execute key.Warning
Be careful about global options in our lab.qmd!
fig-, for example fig-width, fig-height, fig-show, etc.Inside your text you can include code with the syntax `r your-r-code`.
For example, `r 4 + 5` would output 9 in your text.
Code in Quarto
There are `r num_cars` rows in the cars dataset. Four plus five is `r 4 + 5`
Output
There are 50 rows in the cars dataset. Four plus five is 9
04-Code Chunk
In lab.qmd ## Lab 4: Code Chunk, use code chunks to
Include an image https://shorturl.at/IJy1v using knitr::include_graphics("URL or file path")
Include a plot plot(mtcars$disp, mtcars$mpg)
fig-height: 4, fig-width: 6 and fig-align: right to the chunk for your plot. What are the changes?04-Code Chunk
>How do we collapse the code by default in a Quarto HTML document, and show them when needed?
>We have a data setmtcars. How do we show the data set as a good-looking table using R in Quarto?
>I want to use the 2-column format in my Quarto. Teach me with a short example.