library(readxl)
##과제
mlu_data <- read_excel("C:/Users/chosun/Desktop/s/mlu (1) (1).xls", sheet = 2)
library(dplyr)
##
## 다음의 패키지를 부착합니다: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
mlu_data %>% filter(utterances_mlu <= 500) -> test
test
## # A tibble: 5 × 9
## File age utterances_mlu words_mlu DurationTime DurationSec Types_freq
## <chr> <chr> <dbl> <dbl> <chr> <dbl> <dbl>
## 1 27_A0P06M.… A0 470 813 00:12:07 727 378
## 2 28_A0P07M.… A0 371 976 00:11:53 713 419
## 3 15_A1P05F.… A1 381 1046 00:15:14 914 555
## 4 12_A2P04M.… A2 481 1672 00:17:01 1021 921
## 5 18_A2P07M.… A2 323 890 00:08:47 527 476
## # ℹ 2 more variables: Token_freq <dbl>, mlu <dbl>
mlu_data %>% select(-DurationTime, -DurationSec) -> new_mlu_data
new_mlu_data
## # A tibble: 35 × 7
## File age utterances_mlu words_mlu Types_freq Token_freq mlu
## <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 13_A0P04M.cha A0 566 1290 580 1346 2.28
## 2 21_A0P05M.cha A0 565 1602 737 1606 2.84
## 3 27_A0P06M.cha A0 470 813 378 832 1.73
## 4 28_A0P07M.cha A0 371 976 419 979 2.63
## 5 29_A0P08M.cha A0 802 2239 814 2253 2.79
## 6 2_A0P01M.cha A0 563 1243 425 1263 2.21
## 7 30_A0P09F.cha A0 574 1705 828 1712 2.97
## 8 31_A0P10F.cha A0 539 1110 426 1124 2.06
## 9 35_A0P11M.cha A0 705 1847 622 1860 2.62
## 10 36_A0P12M.cha A0 752 2120 1014 2599 2.82
## # ℹ 25 more rows
new_mlu_data <- new_mlu_data %>% rename(utterances = utterances_mlu, words = words_mlu)
new_mlu_data %>%
mutate(mlu = words/utterances) %>%
group_by(age) %>%
summarise(mlu =mean(mlu))
## # A tibble: 3 × 2
## age mlu
## <chr> <dbl>
## 1 A0 2.50
## 2 A1 2.59
## 3 A2 2.99
new_mlu_data %>%
mutate(mlu_new = Token_freq/Types_freq) %>%
group_by(age) %>%
summarise(mlu_new =mean(mlu_new))
## # A tibble: 3 × 2
## age mlu_new
## <chr> <dbl>
## 1 A0 2.57
## 2 A1 2.74
## 3 A2 2.66