Editing Statistics and Statistical Programming (Winter 2021)/Problem set 14
From CommunityData
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 12: | Line 12: | ||
* <code>other_candidate</code> Out-party candidate. | * <code>other_candidate</code> Out-party candidate. | ||
The dataset does not include 2016 or 2020 so | The dataset does not include 2016 or 2020, so we can add those two by hand: | ||
Β | |||
* 2016: You will likely recall that Hillary Clinton was the incumbent party candidate and Donald Trump was the out-party candidate that year. Clinton won approximately 51.1% of the popular vote and a reasonable estimate for per-capita income growth 2012-2016 is 2.2%. | |||
* 2020: I couldn't find solid economic data for 2016-2020 so lets skip this one for now. | |||
You can append the row for the 2016 election to the imported dataset in a bunch of different ways. (I would personally do so using a call to <code>list()</code> nested inside a call to <code>rbind()</code> (e.g., <code>rbind(<hibbs_data>, list(<2016 row>))</code>). You could also explore the <code>add_row()</code> function in the tidyverse. As usual, your mileage may vary.) | You can append the row for the 2016 election to the imported dataset in a bunch of different ways. (I would personally do so using a call to <code>list()</code> nested inside a call to <code>rbind()</code> (e.g., <code>rbind(<hibbs_data>, list(<2016 row>))</code>). You could also explore the <code>add_row()</code> function in the tidyverse. As usual, your mileage may vary.) |