複数の文字列 (テキスト) 変数を含むファイルがあり、各回答者が変数ごとに 1 文または 2 文を書いています。単語の各組み合わせの頻度 (つまり、「能力」が「パフォーマンス」とどのくらいの頻度で発生するか) を見つけられるようにしたいと考えています。これまでの私のコードは次のとおりです。
#Setting up the data file
data.text <- scan("C:/temp/tester.csv", what="char", sep="\n")
#Change everything to lower text
data.text <- tolower(data.text)
#Split the strings into separate words
data.words.list <- strsplit(data.text, "\\W+", perl=TRUE)
data.words.vector <- unlist(data.words.list)
#List each word and frequency
data.freq.list <- table(data.words.vector)
これにより、各単語のリストと、文字列変数に出現する頻度が表示されます。ここで、2 つの単語の組み合わせごとの頻度を確認したいと考えています。これは可能ですか?
ありがとう!
文字列データの例:
ID Reason_for_Dissatisfaction Reason_for_Likelihood_to_Switch
1 "not happy with the service" "better value at other place"
2 "poor customer service" "tired of same old thing"
3 "they are overchanging me" "bad service"