Editing Statistics and Statistical Programming (Winter 2017)/Problem Set: Week 3

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 13: Line 13:
:'''PC6.''' Visualize the data using <code>ggplot2</code> and the <code>geom_point()</code> function. Graphing the <code>x</code> on the x-axis and <code>y</code> on the y-axis seem pretty reasonable! If only it were always so easy! Graph i, j, and k on other dimensions (e.g., color, shape, and size seems reasonable). Did you run into any trouble? How would you work around this?
:'''PC6.''' Visualize the data using <code>ggplot2</code> and the <code>geom_point()</code> function. Graphing the <code>x</code> on the x-axis and <code>y</code> on the y-axis seem pretty reasonable! If only it were always so easy! Graph i, j, and k on other dimensions (e.g., color, shape, and size seems reasonable). Did you run into any trouble? How would you work around this?
:'''PC7.''' A very common step when you import and prepare for data analysis is going to be cleaning and coding data. Some of that is needed here. As is very common, <code>i</code>, <code>j</code> are really dichotomous "true/false" variables but they are coded as 0 and 1 in this dataset. Recode these columns as <code>logical</code>. The variable <code>k</code> is really a categorical variable. Recode this as a factor and change the numbers into textual "meaning" to make it easier. Here's the relevant piece of the codebook (i.e., mapping): 0=none, 1=some, 2=lots, 3=all. The goals is to end up with a factor where those text strings are the levels of the factor. I haven't shown you how to do exactly this but you can solve this with things I have shown you. Or you can try to find a recipe online.
:'''PC7.''' A very common step when you import and prepare for data analysis is going to be cleaning and coding data. Some of that is needed here. As is very common, <code>i</code>, <code>j</code> are really dichotomous "true/false" variables but they are coded as 0 and 1 in this dataset. Recode these columns as <code>logical</code>. The variable <code>k</code> is really a categorical variable. Recode this as a factor and change the numbers into textual "meaning" to make it easier. Here's the relevant piece of the codebook (i.e., mapping): 0=none, 1=some, 2=lots, 3=all. The goals is to end up with a factor where those text strings are the levels of the factor. I haven't shown you how to do exactly this but you can solve this with things I have shown you. Or you can try to find a recipe online.
:'''PC8.''' Take column <code>i</code> and set it equal to NA when if it is FALSE (originally 0). Then set all the values that are NA back to FALSE. Sorry for the busy work! ;)
:'''PC8.''' Take column <code>i</code> and set it equal to NA when if it is FALSE (originally 0). Then set all the values that are NA back to TRUE (originally 1). Sorry for the busy work! ;)
:'''PC9.''' Now that you have recoded your data in PC7, generate new summaries for those three variables. Also, go back and regenerate the visualizations. How have these changed? How are these different from the summary detail you presented above?
:'''PC9.''' Now that you have recoded your data in PC7, generate new summaries for those three variables. Also, go back and regenerate the visualizations. How have these changed? How are these different from the summary detail you presented above?
:'''PC10.''' As always, save your work for all of the questions above as an R script. Commit that R script to your homework git repository and sync/push it to GitHub. Verify that it is online on the GitHub website at the URL linked to from the [[Statistics and Statistical Programming (Winter 2017)/List of student git repositories]] page.
:'''PC10.''' As always, save your work for all of the questions above as an R script. Commit that R script to your homework git repository and sync/push it to GitHub. Verify that it is online on the GitHub website at the URL linked to from the [[Statistics and Statistical Programming (Winter 2017)/List of student git repositories]] page.
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)