我有 2 个矩阵,每个矩阵有 200k 条记录(一个是大的 get_sentences - review_phrases,另一个是 review_scores)。将它们绑定到数据帧中,需要将其写入 csv,但会出现内存错误。我应该怎么办?软件包 bigmemory 或 ff 有帮助吗?
我正在使用 Windows 10 64 位 8GB RAM。内存限制给出以下输出:
memory.limit()
[1] 1.759219e+13
memory.size()
[1] 418.85
这是代码:
sentiment_matrix_final = data.frame (Comment = review_phrases)
df_scores = data.frame(Scores = review_scores)
sentiment_matrix_final = cbind(sentiment_matrix_final, df_scores)
sentiment_matrix_final = data.frame (Comment = review_phrases, Score = review_scores)
str(sentiment_matrix_final)
# Write CSV in R
write.csv(sentiment_matrix_final, file = "Score_sentiment_test.csv")
我得到输出:
>sentiment_matrix_final = data.frame (Comment = review_phrases)
> df_scores = data.frame(Scores = review_scores)
> sentiment_matrix_final = cbind(sentiment_matrix_final, df_scores)
Error: cannot allocate vector of size 750 Kb