-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathanalyze_books.R
55 lines (24 loc) · 962 Bytes
/
analyze_books.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# install.packages('dplyr')
# install.packages('stringr')
# install.packages('tidytext')
# install.packages('tidyr')
# install.packages('ggplot2')
library(dplyr)
library(stringr)
library(tidytext)
library(tidyr)
library(ggplot2)
##### LEXICONS #####
# Use the get_sentiments() function to get your dictionary of positive
# and negative words. Use the lexicon which categorizes words into
# positive and negative.
##### DATA ANALYSIS + WRANGLING #####
# Read books data in
# Map each word in the 'books' dataset to its dictionary-prescribed sentiment.
# Instead of having each individual word, count the number of positive/negative
# words in each chapter.
# A chapter's overarching feeling will be calculated by the number of positive
# words minus the number of negative words. Create a new column called
# 'sentiment' with this value.
##### CREATE OUR VISUALIZATION #####
# Use ggplot to plot each chapter's sentiment by book.