-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathChapter1.qmd
26 lines (18 loc) · 923 Bytes
/
Chapter1.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
# Ch. 1 – Notebook basics
This first notebook is just a demonstration of running R in notebook calculates the correlation between ratings of energy and tension from an existing dataset.
## Preliminaries
To install the `MusicScienceData` package that contains several example datasets used in this book, run the following command.
```{r}
#| eval: false
#if (!require(devtools)) install.packages("devtools",quiet=TRUE)
devtools::install_github("tuomaseerola/MusicScienceData",quiet=TRUE)
```
## Code 1.1
This is the first R code example, which demonstrates loading package that contains datasets, choosing one dataset, and then calculating correlation between two rated concepts (energy and tension).
```{r}
# Code 1.1
library(MusicScienceData) # loads library w data
data <- MusicScienceData::soundtrack # pick data
cor.test(data$Energy, # calc. correlation
data$Tension)
```