Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3 ( Mandatory ) ( 3 0 points ) Open notes, open WWW , work on your own. You should use R and load

Question 3(Mandatory)(30 points)
Open notes, open WWW, work on your own. You should use R and load the
following packages: tm, stringr, and wordcloud.
(Place final answers in provided cells adjacent to questions.)
Use R to mine the book Peoples' History of the U.S.A.1492 to Present by Howard
Zinn.
The text is stored in the file ' UShistory.txt. Answer the questions below.
a) How many words are in the book before cleaning up the text? (hint: use the
str_split() and unlist() routine you performed in the lab)
(round to nearest 10,000, for example 346,344 would be 350,000)
A
b) Clean the text in this exact order. Remember to use the unlisted object you
created from above to start this process:
remove punctuation/special characters
remove digits
make everything lowercase
remove stopwords using the 'english' stopwords in package tm
remove extra whitespace
Now, what is the most frequent term used in this book?
A
c) Using your cleaned text document from question b along with the Positive and
Negative word lexicons provided on blackboard (or already saved in your Google
Colab), compute the sentiment score for this book. That is, what is the result of the
sum() function for negative matching subtracted from the sum() function for positive
matching? (round to nearest 100, for example 8,342 would be 8,300)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions