#Load package
library("mgrtibbles")
#Set seed for random sampling
set.seed("483")
#mushroom_tbl tibble for demonstration
mushroom_tbl <- mgrtibbles::mushroom_tbl |>
#Random sample of 150 rows
dplyr::slice_sample(n = 150, replace=FALSE)
#Reset random seed to normal operation
set.seed(NULL)Tables
You can include tables.
Handmade
The easiest way to create a table in VScode is to:
- Enter visual mode: Right click on markdown page and select
Edit in Visual mode - Click the
Tableoption in the top menu of the page - Click
Insert Table - Choose your preferred options followed by
OK - Fill in your table
Example table:
| qmd | css | yml |
|---|---|---|
| contents | theme | structure |
| lots of files | one dark and one light file and maybe more | one main file |
| Markdown code | scss and css code | quarto |
R table
You can also display R data.frames and matrices. I like to use the reactable package.
library("reactable")Warning: package 'reactable' was built under R version 4.6.1
options(reactable.theme = reactableTheme(
color = "hsl(233, 9%, 87%)",
backgroundColor = "hsl(233, 9%, 19%)",
borderColor = "hsl(233, 9%, 22%)",
stripedColor = "hsl(233, 12%, 22%)",
highlightColor = "hsl(233, 12%, 24%)",
inputStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
selectStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
pageButtonHoverStyle = list(backgroundColor = "hsl(233, 9%, 25%)"),
pageButtonActiveStyle = list(backgroundColor = "hsl(233, 9%, 28%)")
))
mushroom_tbl |>
reactable::reactable()