-
Notifications
You must be signed in to change notification settings - Fork 15
/
quarto.qmd
55 lines (33 loc) · 2.57 KB
/
quarto.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: "Start coding"
subtitle: "Console, script,or Notebook"
---
After installing R, RStudio, and the Tidyverse packages, you're ready to send commands to the R-interpreter.
::: {.callout-warning collapse="true"}
## Best Practice: start with a Project, then edit code
Reproducibility starts at the [foundation](proj.html#reproducibility)! Always begin by opening a project. See [New Projects](proj.html) for tips.
We recommend entering your code in code-chunks (Insert \> code-chunks) within [coding notebooks](quarto.html#notebooks---recomended).
:::
## Console
![R console quadrant in RStudio](images/console.jpg){style="float:left; padding:20px;" width="369"}
\
A very simple way to code is to send commands directly to the *console* (bottom-left quadrant in RStudio). For example: in the RStudio console, type *cars ---* then hit the enter key.
This approach is convenient but not very [reproducible](proj.html#reproducibility).
## Notebooks - RECOMENDED
We recommend using Quarto Documents. This provides a visual notebook where coders blend code with prose, then render publishable documents from the quarto-document. Another option is R Markdown documents; R Markdown is the predecessor to Quarto.
::: column-margin
[![Sample Quarto Document](/images/quarto.jpg)](https://quarto.org/docs/get-started/hello/rstudio.html#authoring)
:::
The basic steps are
1. Begin new Quarto document (`File > New file > Quarto document`)
2. Compose explanation of goals and code-chunks using *natural language* (i.e. prose)
3. Add code-chunks (`Ctrl-Alt-i`) to compose code. (intersperse code-chunks with prose)
4. Render document into a publishable report[^1]
[^1]: Many report formats are available including: PDF, MS Word, Slides, PPTX, HTML, EPUB, Web sites, Blogs, Interactive interfaces.
### Recommended Quarto links
- [Quarto tutorial](https://quarto.org/docs/get-started/hello/rstudio.html) (Includes step-by-step [hello.qmd document](https://quarto.org/docs/get-started/hello/rstudio/_hello.qmd): from authoring to rendering )
- Quarto [FAQ for R Markdown](https://quarto.org/docs/faq/rmarkdown.html) users
- Quarto [example](https://quarto.org/docs/gallery/) publication types. Plus [guides](https://quarto.org/docs/guide/) and [deep-references docs](https://quarto.org/docs/reference/)
## Scripts - plain vanilla
You can also code the old fashion way using a plain vanilla .R script.[^2]
[^2]: `File > New file > R script`. There is no mandate to join the twenty-first century and honor academic values like *reproducibility, such as* rendering reports from code. You do you. I don't judge 😃