Self reported scores on the SAT Verbal, SAT Quantitative and ACT were collected as part of the Synthetic Aperture Personality Assessment (SAPA) web based personality assessment project. Age, gender, and education are also reported. The data from 700 subjects are included here as a demonstration set for correlation and analysis.
Examples
This section includes code for the examples shown. These may differ slightly from the examples shown in the live demonstration.
Example 1: Your first Quarto document
See example
example1.qmd
---title: "My Document"author: "Nicola Rennie"format: html---## QuartoQuarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.## Running CodeWhen you click the **Render** button a document will be generated that includes both content and the output of embedded code. You can embed code like this:```{r}1 + 1```You can add options to executable code like this ```{r}#| echo: false2 * 2```The `echo: false` option disables the printing of code (only output is displayed).
Example 2: Document content
You can download the image file here (or find your own!): lemurs.jpg
See example
example2.qmd
---
title: "My Document"
author: "Nicola Rennie"
format: html
---
# Level 1 Heading
## Level 2 Heading
We can write lists in markdown. For example, the top 3 best animals:
- lemurs
- dogs
- hedgehogs
Numbered lists are made easier in markdown:
1. lemurs
2. dogs
3. hedgehogs
You can make text *italic* or **bold**.
We can add images:
![](lemurs.jpg){fig-align="center" width="50%"}
and tables:
| Animal | Score |
|----------|-------|
| Lemur | 10 |
| Dog | 9 |
| Hedgehog | 8 |
: Rating of animals
Example 3: Code blocks
See example
example3.qmd
---title: "My Document"author: "Nicola Rennie"format: htmlexecute: eval: true echo: false---# Level 1 Heading## Level 2 HeadingWe can write lists in markdown. For example, the top 3 best animals:- lemurs- dogs- hedgehogsNumbered lists are made easier in markdown:1. lemurs2. dogs3. hedgehogsYou can make text *italic* or **bold**.We can add images:![](lemurs.jpg){fig-align="center" width="50%"}and tables:| Animal | Score ||----------|-------|| Lemur | 10 || Dog | 9 || Hedgehog | 8 |: Rating of animals## Analysis```{r}#| label: load-datalibrary(psych)data(bfi)```Adding a plot```{r}#| label: age-hist#| fig-align: center#| fig-width: 6#| fig-height: 6#| fig-cap: "A histogram of participant age"hist(bfi$age, xlab = "Age", main = "")```Prepare data for a table:```{r}#| label: table-prepdata("sat.act")sat_summary <- aggregate( cbind(SATV, SATQ) ~ education, FUN = mean, data = sat.act)```Make a table:```{r}#| tbl-cap: "Mean scores by education level"library(tinytable)tt(sat_summary)```
Example 4: Document referencing
See example
example4.qmd
---title: "My Document"author: "Nicola Rennie"bibliography: references.bibformat: htmlnumber-sections: trueexecute: eval: true echo: false---# Level 1 Heading## Level 2 HeadingWe can write lists in markdown. For example, the top 3 best animals:- lemurs- dogs- hedgehogsNumbered lists are made easier in markdown:1. lemurs2. dogs3. hedgehogsYou can make text *italic* or **bold**.We can add images such as @fig-lemur![](lemurs.jpg){#fig-lemur fig-align="center" width="50%"}and tables:| Animal | Score ||----------|-------|| Lemur | 10 || Dog | 9 || Hedgehog | 8 |: Rating of animals## Analysis {#sec-analysis}In @sec-analysis we explore the data.```{r}#| label: load-datalibrary(psych)data(bfi)```Adding a plot such as a histogram in @fig-age-hist:```{r}#| label: fig-age-hist#| fig-align: center#| fig-width: 6#| fig-height: 6#| fig-cap: "A histogram of participant age"hist(bfi$age, xlab = "Age", main = "")```Prepare data for a table:```{r}#| label: table-prepdata("sat.act")sat_summary <- aggregate( cbind(SATV, SATQ) ~ education, FUN = mean, data = sat.act)```Make a table using the {tinytable} package [@tinytable]:```{r}#| tbl-cap: "Mean scores by education level"library(tinytable)tt(sat_summary)```
references.bib
@Manual{tinytable,
title = {tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown',
'Word', 'PNG', 'PDF', and 'Typst' Formats},
author = {Vincent Arel-Bundock},
year = {2024},
note = {R package version 0.2.1},
url = {https://CRAN.R-project.org/package=tinytable},
}
Example 5: Formatting documents
See example
example5.qmd
---title: "My Document"format: tandf-pdfbibliography: references.bibexecute: eval: true echo: false---# Level 1 Heading## Level 2 HeadingWe can write lists in markdown. For example, the top 3 best animals:- lemurs- dogs- hedgehogsNumbered lists are made easier in markdown:1. lemurs2. dogs3. hedgehogsYou can make text *italic* or **bold**.We can add images such as @fig-lemur![](lemurs.jpg){#fig-lemur fig-align="center" width="50%"}and tables:| Animal | Score ||----------|-------|| Lemur | 10 || Dog | 9 || Hedgehog | 8 |: Rating of animals## Analysis {#sec-analysis}In @sec-analysis we explore the data.```{r}#| label: load-datalibrary(psych)data(bfi)```Adding a plot such as a histogram in @fig-age-hist:```{r}#| label: fig-age-hist#| fig-align: center#| fig-width: 6#| fig-height: 6#| fig-cap: "A histogram of participant age"hist(bfi$age, xlab = "Age", main = "")```Prepare data for a table:```{r}#| label: table-prepdata("sat.act")sat_summary <- aggregate( cbind(SATV, SATQ) ~ education, FUN = mean, data = sat.act)```Make a table using the {tinytable} package [@tinytable]:```{r}#| tbl-cap: "Mean scores by education level"library(tinytable)tt(sat_summary)```
references.bib
@Manual{tinytable,
title = {tinytable: Simple and Configurable Tables in 'HTML', 'LaTeX', 'Markdown',
'Word', 'PNG', 'PDF', and 'Typst' Formats},
author = {Vincent Arel-Bundock},
year = {2024},
note = {R package version 0.2.1},
url = {https://CRAN.R-project.org/package=tinytable},
}
In the same folder as example5.qmd there should be the lemurs.jpg image, and another folder called _extensions/mikemahoney218/tandf. When you render the document, you should also see orcidlink.sty and interact.csl files.