Here are a few reminders and some things to be on the look-out for in Chapter 4.
REMINDER: The default mirror for gutenberg_download()
is now functioning. You don’t need to manually set your mirror location any longer.
NEW PACKAGES: The following packages are new this week and will need to be installed prior to use: ggraph
, igraph
, widyr
PROGRAMMING TECHNIQUES: When we expect to perform analyses multiple times, on different texts but where the steps will be the same, it makes sense to write our analysis into a function that can just be called any time we want to perform the corresponding analysis. Functions are sets of instructions that can be called and run over and over again on different (but similarly structured) objects. You’ll be exposed to writing functions in this chapter.
AN ERROR I ENCOUNTERED: The graph_from_data_frame()
function in the igraph
package requires a data frame with at least two columns. For a given row, the tokens in these first two columns are interpreted as the endpoints of the edge represented by that row. Any additional columns can contain attributes for that edge (for example, a weight as in the textbook). If you have trouble generating the graphs in the textbook, take a look at the data frame you are feeding the graph_from_data_frame()
function – it should have three columns, word1
, word2
, and n
– if you used the unite()
function to bring your bigrams back to a single column, then you’ll only have two columns and you won’t be able to generate the graph(s).
That’s all for now. Post questions you have in Slack and/or bring them with you to our Thursday live meeting.