manufacturer model displ year
Length:234 Length:234 Min. :1.600 Min. :1999
Class :character Class :character 1st Qu.:2.400 1st Qu.:1999
Mode :character Mode :character Median :3.300 Median :2004
Mean :3.472 Mean :2004
3rd Qu.:4.600 3rd Qu.:2008
Max. :7.000 Max. :2008
cyl trans drv cty
Min. :4.000 Length:234 Length:234 Min. : 9.00
1st Qu.:4.000 Class :character Class :character 1st Qu.:14.00
Median :6.000 Mode :character Mode :character Median :17.00
Mean :5.889 Mean :16.86
3rd Qu.:8.000 3rd Qu.:19.00
Max. :8.000 Max. :35.00
hwy fl class
Min. :12.00 Length:234 Length:234
1st Qu.:18.00 Class :character Class :character
Median :24.00 Mode :character Mode :character
Mean :23.44
3rd Qu.:27.00
Max. :44.00
Chunk Options
Common options using #| syntax:
label: - name your chunk
echo: false - hide code
eval: false - don’t run code
include: false - run but hide everything
warning: false - suppress warnings
message: false - suppress messages
Visual vs Source Editor
Visual Editor:
WYSIWYM interface (like Google Docs)
Easy for beginners
Insert menu and shortcuts (⌘ / or Ctrl /)
Source Editor:
Plain markdown
More control
Better for debugging
Rendering Documents
Three ways to render:
Click Render button
Keyboard: Cmd/Ctrl + Shift + K
Console: quarto::quarto_render("file.qmd")
Creates HTML, PDF, Word, or other formats
Figure Sizing
Recommended settings:
fig-width controls R figure size
out-width controls output display size
fig-asp sets aspect ratio (golden ratio)
Multiple Plots
Use layout-ncol for side-by-side plots:
Tables
Basic table with knitr::kable():
First 5 columns of mtcars
mpg
cyl
disp
hp
drat
Mazda RX4
21.0
6
160
110
3.90
Mazda RX4 Wag
21.0
6
160
110
3.90
Datsun 710
22.8
4
108
93
3.85
Hornet 4 Drive
21.4
6
258
110
3.08
Hornet Sportabout
18.7
8
360
175
3.15
Valiant
18.1
6
225
105
2.76
For advanced tables: gt, kableExtra, reactable
Inline Code
Embed R results directly in text:
We analyzed 53940 diamonds.Only 126 exceeded 2.5 carats.
Output: “We analyzed 53,940 diamonds. Only 126 exceeded 2.5 carats.”