text processinguse readlines to read soutxt into


Text Processing:

Use readLines to read SOU.txt into R. Create a vector called Pres containing the names of the presidents giving each speech. To do this, rst identify the lines containing this information, then use the tagging and back-referencing strategy we covered in class. Remove any whitespace at the beginning or end of the strings.

 Create an empty list using the command

speech.words <- vector("list", length(Pres))

Note that length(Pres) is the total number of speeches. Now loop over the speeches and ll in the elements of each list as follows. Each element in the list should be a character vector, where each element of the vector is a word in the speech. Hint: For a given speech (one iteration in the loop), rst put the text of the speech into one long character vector (where in relation to the delimiters does it start and stop?), then use the function strsplit to break it up. There are more careful ways to do this, but you can consider \word characters" to
consist only of letters, so that what de nes the breaks between words is one or more \non-word characters.

Request for Solution File

Ask an Expert for Answer!!
Database Management System: text processinguse readlines to read soutxt into
Reference No:- TGS0206314

Expected delivery within 24 Hours