Daten & Packages laden

Laden Sie die folgenden Packages und Data Frames:

library(tidyverse)
urla = "https://www.phonetik.uni-muenchen.de/studium_lehre/"
urlb = "lehrmaterialien/R_speech_processing/Rdf"
url = paste0(urla, urlb)
rating <- read.table(file.path(url, "rating.txt"), 
                     stringsAsFactors = T)
preasp <- read.table(file.path(url, "preasp.txt"), 
                     stringsAsFactors = T)
asp <- read.table(file.path(url, "asp.txt"), 
                  stringsAsFactors = T)
vdata <- read.table(file.path(url, "vdata.txt"), 
                    stringsAsFactors = T)

Q & A’s

rating %>%
  group_by(Vpn, Lang) %>%
  summarise(x = median(Rating)) %>%
  ungroup()
## `summarise()` has regrouped the output.
## ℹ Summaries were computed grouped by Vpn and Lang.
## ℹ Output is grouped by Vpn.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(Vpn, Lang))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.
## # A tibble: 26 × 3
##    Vpn   Lang      x
##    <fct> <fct> <dbl>
##  1 S1    E      6.5 
##  2 S10   E      5.75
##  3 S11   E      5.83
##  4 S12   E      5.25
##  5 S13   E      6.2 
##  6 S14   S      4.75
##  7 S15   S      5.58
##  8 S16   S      5.92
##  9 S17   S      6.75
## 10 S18   S      5.58
## # ℹ 16 more rows
r2 = rating %>%
  mutate(Lrating = log(Rating)) 
rating %>%
  group_by(Gram, Type, Fam) %>%
  summarise(anzahl = n()) %>%
  ungroup()
## `summarise()` has regrouped the output.
## ℹ Summaries were computed grouped by Gram, Type, and Fam.
## ℹ Output is grouped by Gram and Type.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(Gram, Type, Fam))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.
## # A tibble: 8 × 4
##   Gram     Type       Fam   anzahl
##   <fct>    <fct>      <fct>  <int>
## 1 High     Identical  New       26
## 2 High     Identical  Old       26
## 3 High     Structural New       26
## 4 High     Structural Old       26
## 5 Moderate Identical  New       26
## 6 Moderate Identical  Old       26
## 7 Moderate Structural New       26
## 8 Moderate Structural Old       26
# oder
rating %>%
  count(Gram, Type, Fam) 
##       Gram       Type Fam  n
## 1     High  Identical New 26
## 2     High  Identical Old 26
## 3     High Structural New 26
## 4     High Structural Old 26
## 5 Moderate  Identical New 26
## 6 Moderate  Identical Old 26
## 7 Moderate Structural New 26
## 8 Moderate Structural Old 26
rating %>%
  filter(Vpn == "S1" | Vpn == "S10") %>%
  group_by(Fam, Vpn) %>%
  summarise(mean(Rating)) %>%
  ungroup()
## `summarise()` has regrouped the output.
## ℹ Summaries were computed grouped by Fam and Vpn.
## ℹ Output is grouped by Fam.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(Fam, Vpn))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.
## # A tibble: 4 × 3
##   Fam   Vpn   `mean(Rating)`
##   <fct> <fct>          <dbl>
## 1 New   S1              6.37
## 2 New   S10             5.84
## 3 Old   S1              6.19
## 4 Old   S10             6.08
# Alternativ:
rating %>%
  filter(Vpn %in% c("S1", "S10")) %>%
  group_by(Fam, Vpn) %>%
  summarise(mean(Rating)) %>%
  ungroup()
## `summarise()` has regrouped the output.
## ℹ Summaries were computed grouped by Fam and Vpn.
## ℹ Output is grouped by Fam.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(Fam, Vpn))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.
## # A tibble: 4 × 3
##   Fam   Vpn   `mean(Rating)`
##   <fct> <fct>          <dbl>
## 1 New   S1              6.37
## 2 New   S10             5.84
## 3 Old   S1              6.19
## 4 Old   S10             6.08
vdata %>%
  filter(V %in% c("Y", "U")) %>%
  group_by(Subj, V) %>%
  summarise(logf1f2 = mean(log(F2/F1))) %>%
  ungroup()
## `summarise()` has regrouped the output.
## ℹ Summaries were computed grouped by Subj and V.
## ℹ Output is grouped by Subj.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(Subj, V))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.
## # A tibble: 14 × 3
##    Subj  V     logf1f2
##    <fct> <fct>   <dbl>
##  1 bk    U       0.908
##  2 bk    Y       1.66 
##  3 ck    U       1.11 
##  4 ck    Y     Inf    
##  5 fs    U       0.789
##  6 fs    Y       1.50 
##  7 hp    U       1.04 
##  8 hp    Y       1.72 
##  9 ht    U       0.885
## 10 ht    Y       1.58 
## 11 mh    U       1.07 
## 12 mh    Y       1.74 
## 13 ta    U       0.984
## 14 ta    Y       1.70
vdata %>%
  filter(V == "A") %>%
  group_by(Cons) %>%
  summarise(mF1 = mean(F1)) %>%
  ungroup()
## # A tibble: 3 × 2
##   Cons    mF1
##   <fct> <dbl>
## 1 K      637.
## 2 P      646.
## 3 T      652.
vdata %>%
  group_by(V, Tense) %>%
  summarise(mF1 = mean(F1), 
            mF2 = mean(F2)) %>%
  ungroup()
## `summarise()` has regrouped the output.
## ℹ Summaries were computed grouped by V and Tense.
## ℹ Output is grouped by V.
## ℹ Use `summarise(.groups = "drop_last")` to silence this message.
## ℹ Use `summarise(.by = c(V, Tense))` for per-operation grouping
##   (`?dplyr::dplyr_by`) instead.
## # A tibble: 14 × 4
##    V     Tense   mF1   mF2
##    <fct> <fct> <dbl> <dbl>
##  1 %     -      479. 1458.
##  2 %     +      368. 1493.
##  3 A     -      622. 1326.
##  4 A     +      668. 1249.
##  5 E     -      488. 1729.
##  6 E     +      363. 2024.
##  7 I     -      346. 1811.
##  8 I     +      276. 2127.
##  9 O     -      520. 1009.
## 10 O     +      348.  686.
## 11 U     -      348.  938.
## 12 U     +      259.  681 
## 13 Y     -      338. 1476.
## 14 Y     +      266. 1673.
v2 = vdata %>%
  mutate(D = case_when(dur < 75 ~ "low",
                       dur > 200 ~ "high",
                       TRUE ~ "mid"))
v2 %>%
  filter(Tense == "-") %>%
  group_by(D) %>%
  summarise(n())
## # A tibble: 3 × 2
##   D     `n()`
##   <chr> <int>
## 1 high      1
## 2 low      27
## 3 mid    1475
# oder
v2 %>%
  filter(Tense == "-") %>%
  count(D)
##      D    n
## 1 high    1
## 2  low   27
## 3  mid 1475
preasp %>%
  filter(vtype == "o" & cplace == "kk") %>%
  slice_max(vdur) %>%
  pull(city)
## [1] milano
## 15 Levels: bari bergamo cagliari Catanzaro firenze genova lecce ... venezia
p2 = preasp %>%
  mutate(CV = clodur + vdur)

p2 %>%
  filter(region == "N") %>%
  group_by(word) %>%
  summarise(mean(CV))
## # A tibble: 8 × 2
##   word         `mean(CV)`
##   <fct>             <dbl>
## 1 bocca             0.301
## 2 bottoni           0.249
## 3 cappello          0.240
## 4 macchina          0.217
## 5 occhi             0.315
## 6 specchiettok      0.188
## 7 specchiettot      0.318
## 8 tetto             0.340