Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save kawasaki2013/1b62b6ce6c5af03ecd995df152d36585 to your computer and use it in GitHub Desktop.

Select an option

Save kawasaki2013/1b62b6ce6c5af03ecd995df152d36585 to your computer and use it in GitHub Desktop.
小説 不思議の国のアリス ワードリスト(頻度上位50位まで)
# 分析データ
library(languageR)
data(alice)
# 全ての文字を小文字に変換
alice.lower <- tolower(alice)
# ワードリストの作成
freq.list <- table(alice.lower)
sorted.freq.list <- sort(freq.list, decreasing = TRUE)
sorted.table <- paste(names(sorted.freq.list), sorted.freq.list, sep = ": ")
# ワードリスト(頻度上位50位まで)の確認
head(sorted.table, 50)
@kawasaki2013
Copy link
Author

ワードリスト(頻度上位50位まで)の確認

head(sorted.table, 50)
[1] "the: 1639" "and: 866" "to: 725" "a: 631" "it: 595"
[6] "she: 553" "i: 545" "of: 511" "said: 462" "you: 411"
[11] "alice: 398" "in: 367" "was: 357" "that: 315" "as: 263"
[16] "her: 248" "t: 218" "at: 212" "s: 201" "on: 193"
[21] "all: 182" "with: 180" "had: 178" "but: 170" "for: 153"
[26] "they: 152" "so: 151" "be: 148" "not: 145" "very: 144"
[31] "what: 141" "this: 134" "little: 128" "he: 125" "out: 113"
[36] "is: 108" "one: 104" "down: 102" "there: 99" "up: 98"
[41] "his: 96" "if: 96" "about: 94" "then: 94" "no: 90"
[46] "know: 88" "them: 88" "like: 85" "were: 85" "again: 83"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment