Follow the setup instructions given here, i.e. download R and RStudio, create a directory on your computer where you will store files on this course, make a note of the directory path, create an R project that accesses this directory, and install all indicated packages.
For this and subsequent tutorials, access the tidyverse
,magrittr
, emuR
, and wrassp
libraries:
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
##
## Attaching package: 'magrittr'
##
## The following object is masked from 'package:purrr':
##
## set_names
##
## The following object is masked from 'package:tidyr':
##
## extract
##
## Attaching package: 'emuR'
##
## The following object is masked from 'package:base':
##
## norm
a = "https://www.phonetik.uni-muenchen.de/~jmh/"
b = "lehre/Rdf/kiel_butter1.zip"
down_path = paste(a, b, sep="/")
download.file(down_path,
file.path(sourceDir, "kiel_butter1.zip"))
# Create directory in sourceDir called 'butter'
dir.create(file.path(sourceDir, "butter"))
# unzip the file into that directory
unzip(file.path(sourceDir, "kiel_butter1.zip"),
exdir = file.path(sourceDir, "butter"))
path.butter = file.path(sourceDir, "butter")
list.files(path.butter)
convert_TextGridCollection(path.butter,
dbName = "butter",
targetDir = targetDir)
Create the Emu database
Identify [s, S] segments
Calculate ZCR on the fly
First plot
Normalise length
Prepare data for an aggregate plot
fric.zcr.norm.m =
fric.zcr.norm %>%
group_by(times_norm, labels) %>%
summarise(T1 = mean(T1)) %>% ungroup
## `summarise()` has grouped output by 'times_norm'. You can override using the
## `.groups` argument.
Aggregate normalised time plot
fric.zcr.norm.m %>%
ggplot +
aes(y = T1, x = times_norm, col=labels, group=labels) +
geom_line() +
ylab("Zero-crossing-rate (Hz)")+
xlab("Proportional time")