Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
dat <- vroom(...)
problems(dat)
Rows: 528 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
dat <- vroom(...)
problems(dat)
Rows: 9771 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
dat <- vroom(...)
problems(dat)
Rows: 4918 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
dat <- vroom(...)
problems(dat)
Rows: 9932 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
dat <- vroom(...)
problems(dat)
Rows: 13121 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
dat <- vroom(...)
problems(dat)
Rows: 5244 Columns: 1
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): X1
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# A tibble: 68 × 3
word1 word2 n
<chr> <chr> <int>
1 careful tris 3
2 1 tris 1
3 6 tris 1
4 ahead tris 1
5 boyfriend tris 1
6 brave tris 1
7 congratulations tris 1
8 hallucination tris 1
9 hey tris 1
10 human tris 1
# ℹ 58 more rows
# A tibble: 43 × 3
word1 word2 n
<chr> <chr> <int>
1 tris al 1
2 tris climbed 1
3 tris lauren 1
4 tris tobias 1
5 tris uriah 1
6 tris christina 3
7 tris nita 3
8 tris tobias 3
9 tris sits 2
10 tris stands 2
# ℹ 33 more rows
Joining with `by = join_by(word, n, Book, Series)`
merged |>mutate(word =gsub(pattern ='[[:punct:]]', replacement ='', word) ) -> mergedmerged |>inner_join(get_sentiments('afinn')) |>group_by(Book) |>summarize(average =mean(value)) |>ggplot(aes(Book, average, fill = average)) +geom_col() +coord_flip() +theme_classic() +labs(x='Book', y='Average', title ="Sentiment Analysis of The Hunger Games and Divergent Series" )
Joining with `by = join_by(word)`
merged |>arrange(desc(n)) |>filter(!word %in%c("tris","tobias","peeta","im", "haymitch","gale","finnick","dont","christina", "its", "im", "dont", "it's", "i'm", "hand", "nita", "doesnt", "caleb", "eric", "cant", "plutarch", "marcus", "jeanine", "ive", "hes", "al", "cara", "peter", "cara", "snow", "katniss", "rue", "mathew", "ing", "didnt", "boggs", "matthew", "evelyn", "david")) |>head(65) |>ggplot(aes(word, n, fill=word)) +geom_col() +coord_flip() +theme_classic() +labs( x ="Word", y ="Frequency of Word ", title ="Most Common Overlapping Words in The Hunger Games and Divergent Series")
hunger_games_books |>arrange(desc(n)) |>filter(!word %in%c("peeta","im", "haymitch","gale","finnick","dont","prim", "its", "im", "dont", "it's", "i'm", "hand", "katniss", "plutarch", "ill", "hes", "cato", "ive", "rue", "snow", "cinna", "shes", "beetee", "johanna", "boggs" , "peeta's")) |>head(40) |>ggplot(aes(word, n, fill=word)) +geom_col() +coord_flip() +theme_classic()+labs( x ="Word", y="Number of Times the Word Was in the Series", title ="Top Words in The Hunger Games Series")
divergent_books |>mutate(word =gsub(pattern ='[[:punct:]]', replacement ='', word) ) -> divergent_booksdivergent_books |>arrange(desc(n)) |>filter(! word %in%c("tris", "tobias", "nita", "marcus", "jeanine", "it's", "i'm", "don't", "can't", "christina", "im", "its", "dont", "cant", "al", "caleb", "cara", "eric", "doesnt", "matthew", "peter", "ing", "didnt", "hands")) |>head(40) |>ggplot(aes(word, n, fill=word)) +geom_col() +coord_flip() +theme_classic() +labs(y="Number of Times the Word was in the Series ", x="Word", title ="Top Words in The Divergent Series")