I started going through the Text Mining with R textbook, and while running the code from the textbook, R is crashes. I looked in /var/logs/rstudio/server/*
for any hints, and could find nothing. Also, in the console I saw nothing related to why the system was crashing. When R does crash after running this code, I see an error pop up which is generic and stating that R has crashed abnormally and I may have experienced data loss.
I've tried restarting R several times, updating packages, and nothing has worked.
How do I go about debugging this issue, or is there a solution to this type of issue?
Version: RStudio Server2022.07.1 Build 554
OS: Arch Linux
Kernel: 5.19.11-arch1-1
CPU: Intel i5-6500 (4) @ 3.600GHz
RAM: 16Gb
GPU: NVIDIA GeForce GTX 1050 Ti
This is the code I am running:
library(dplyr)
library(tidyverse)
text <- c("Because I could not stop for Death -",
"He kindly stopped for me -",
"The Carriage held but just Ourselves -",
"and Immortality")
text_df <- data_frame(line=1:4, text=text)
text_df
library(tidytext)
?unnest_tokens
text_df %>%
unnest_tokens(word, text)
library(janeaustenr)
original_books <- austen_books() %>%
group_by(book) %>%
mutate(linenumber = row_number(),
chapter = cumsum(str_detect(text, regex("^chapter [\\divxlc]", ignore_case = TRUE)))) %>%
ungroup()
original_books
tidy_books <- original_books %>%
unnest_tokens(word, text)
tidy_books
data(stop_words)
tidy_books <- tidy_books %>%
anti_join(stop_words)
tidy_books %>%
count(word, sort = TRUE)
** The code block below is what causes R to crash, and dump the data environment.**
tidy_books %>%
count(word, sort = TRUE) %>%
filter(n > 600) %>%
mutate(word = reorder(word, n)) %>%
ggplot(aes(word, n)) +
geom_col() +
xlab(NULL) +
coord_flip()