[1] 2
Activity 1 due at the end of next week
Instructions are available at the top of the activity
For graduate students: identify 5 papers that are important to your dissertation, whose results you think it would be important to reproduce
Quarto files are designed to be used in three ways:
For communicating to decision-makers, who want to focus on the conclusions, not the code behind the analysis.
For collaborating with other data scientists (including future you!), who are interested in both your conclusions, and how you reached them (i.e. the code).
As an environment in which to do data science, as a modern-day lab notebook where you can capture not only what you did, but also what you were thinking.
— R for Data Science, Ch. 28
qmd
file(link to download this file)
Lines 1–5: “YAML” header - this is the space to add information about your file (title, author, date, additional details).
---
)key: value
formatLines 7–15: R
code chunk
```{r} {code} ```
)Lines 16–20: Text in Markdown
*
around a word to italicize: *quarto*
becomes quartoqmd
filesYAML
header of the file*text in italics*
\(\to\) text in italics
**text in bold**
\(\to\) text in bold
***text in bold-italic***
\(\to\) text in bold-italic
[underlined text]{.underline}
\(\to\) underlined text
[text in small caps]{.smallcaps}
\(\to\) text in small caps
text with ^superscript^ or ~subscript~
\(\to\)
text with superscript or subscript
$\frac{dN}{dt} = rN$
\(\to\) \(\frac{dN}{dt} = rN\)
Community ecology is a mess [@lawton_1999]
\(\to\) Community ecology is a mess (Lawton 1999)
You can also add footnotes^[like this]
\(\to\) You can also add footnotes1

\(\to\)
# Header 1
## Header 2
### Header 3
See https://quarto.org/docs/authoring/markdown-basics.html for a comprehensive guide to markdown options
R
Code in qmd
documents, we need to insert code “chunks”The keyboard shortcut Cmd + Option + I / Ctrl + Alt + I.
The “Insert” button icon in the editor toolbar.
By manually typing the chunk delimiters ```{r}
and ```
.
— R for Data Science, Ch. 28
As seen in Listing 1, 1+1=2
R
chunks can be shown but not run (“evaluated”)R
code chunks can control the appearance of the outputR
code chunks can control the appearance of the outputR
code chunks can control the appearance of the outputReminder of “Project” oriented workflow: every time you come to class, or sit down to work on class material, open the appropriate project in RStudio, and work from there.
As of now, very few regular pushes onto gitlab (at least in publicly viewable repositories)
Consistency is your best friend for getting into a habit, so try to push notes at least once at the end of class. Bonus points for setting up RProjects for your other coursework. Extra-bonus for tracking these with git.
|>
: Piping in R
“Take the output of the left side, and pass it as input to the command on the right side”
For a review, revisit Episode 4 of the Software Carpentry workshop on the Bash Shell: link
|>
: Piping in R
Consider some computations on a vector vec
:
vec
vec
(i.e. vec[2]-vec[1]
, vec[3]-vec[2]
, …)Modify demo.qmd
to show how figure captions can be generated, figures can be cross-referenced, and ditto for tables. :heavy_check_mark:
If your figures are generated by code within the quarto document, no need to separately insert them - automatically inserted when you render the file!
If you have additional figures (e.g. to add a microscopy photo), use markdown syntax:
BibTeX entries; CSL files
Link to CSL repository
Quarto as a “swiss army knife” for scientific writing
When preparing a manuscript for journal submission, there’s several moving pieces to manage:
Quarto can help with all!