前提・実現したいこと
元々入力していた文字列データを形態素解析し、
ネガティブ・ポジティブ度数を表示する
発生している問題・エラーメッセージ
エラー: by
required, because the data sources have no common variables
Run rlang::last_error()
to see where the error occurred.
22.
stop(fallback)
21.
signal_abort(cnd)
20.
.abort(text)
19.
glubort(fmt_args(args), ..., .envir = .envir)
18.
bad_args("by", "required, because the data sources have no common variables")
17.
common_by.NULL(by, x, y)
16.
common_by(by, x, y)
15.
left_join.tbl_df(tbl_df(x), y, by = by, copy = copy, ...)
14.
left_join(tbl_df(x), y, by = by, copy = copy, ...)
13.
as.data.frame(left_join(tbl_df(x), y, by = by, copy = copy, ...))
12.
left_join.data.frame(., dic2)
該当のソースコード
write.table(result,"temp.txt",quote=F,row.names=F,col.names=F,append=F)
result.docdf <- docDF("temp.txt", pos = c("名詞","形容詞"))
result.docdf %<>% dplyr::rename(FREQ = temp.txt) %>% arrange(FREQ)
dic <- read.csv("C:/Users/owner/単語感情極性対応表_日本語版.dic", sep=":",stringsAsFactors=FALSE, header=FALSE)
dic2 <- dic %>% select(V1, V4) %>% rename(TERM=V1, NP=V4)
dic2 %<>% distinct(TERM, .keep_all=TRUE)
result.docdf2 <- result.docdf %>% left_join(dic2)
posi <- sum(result.docdf2$FREQ[result.docdf2$NP > 0], na.rm=TRUE)
nega <- sum(result.docdf2$FREQ[result.docdf2$NP < 0], na.rm=TRUE)
補足情報(FW/ツールのバージョンなど)
resultのclassはcharacterのリストで、
辞書データは
優れる:すぐれる:動詞:1
良い:よい:形容詞:0.999995
喜ぶ:よろこぶ:動詞:0.999979.....
のような形式になっております。
R初心者のため全く勝手が分らず暗中模索しているところです・・
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/12/29 10:34