Question
Solve in R Part A: Enter code to produce the structure of your dataframe Part B: 1. Indicate the number of rows and columns:
Solve in R
Part A: Enter code to produce the structure of your dataframe
Part B: 1. Indicate the number of rows and columns: Rows = Columns =
2. Which variables would be appropriate for examination by histogram?
3. Why are these variables appropriate for histograms? ```{r} #Question 1 Part A code goes here! ```
QUESTION 2. Part A: Generate descriptive statistics (fav_stats) for one of the variables you listed in Question 1:PartB2, and save them to a new object. Name your object using the format 'VariableName.stats' Part B: Provide the min, mean, median, max, and IQR for this variable. ```{r} #Your code goes here! #1) Generate descriptive stats for your categorical variable from question 1. #2) Print these new objects to view the output ```
QUESTION 3 . Part A: Write code to produce a histogram of the variable you indicated in the last question. Part B: Describe the shape of the histogram This is a histogram of the Age variable, which displays a somewhat normal distrubution. The value with the most instances appears to be ~50 or 51 and the least, appears to be ~95. The distribution is slightly skewed. Kurtosis = light tailed. ```{r} #Your code goes here! ```
QUESTION 4. Part A: Recode Sex into new variable called "Gender" where 1 = Male and 0 = Female. ```{r} #Your code goes here! ```
QUESTION 5 Part A: Check that your code worked by viewing the first and last six rows of your new variable ```{r} #Your code goes here! ```
QUESTION6: Part A: 1. Rewrite your histogram from Question 5 and this time fill it in using the 'Gender' variable from question 4. (Note: This will allow you to differentiate between male and female instances.) 2. Add 10 bins 3. Label the title and x-axis of the histogram using gf_labs=title"", x="" 4. separate the histogram by gender using gf_facet_grid(variable ~.) Part B: What can you determine from the new histogram output? ```{r} #Your code goes here! ```
QUESTION 7:Part A: Create a new categorical variable called Age3Cat from the Age variable. Part B: 1.How many instances of each category are there in your new variable? (*hint: tally) 2. What is the proportion of each category? ```{r} #Your code goes here! #Check your work ```
QUESTION 8:Part A: Evaluate Income and Age by your Age3Cat variable. 1. Create a box plot of Age by Age3Cat. 2. Create a box plot of Income by Age3Cat. Part B: 1. Which group appears to have the greatest spread for age? 2. Which group appears to have the most outliers for income? (Estimate the max income based on the chart.) ______ ```{r} #Your code goes here! ```
QUESTION 9:Part A: Your boss has asked you to investigate whether there is an association between age and income among employees. Make a chart that displays how much employees make (Income) based on their age. Visualize this using a scatterplot - Include these arguments: size = 3, color=~Age Part B: Do you notice anything? ```{r} #Your code goes here! ```
QUESTION 10:There's some data that doesnt seem to make sense. It looks like a cube on the left side of your scatterplot! We want to remove that so we can visualize Income by Age the correct way. Part A: Filtering exercise. Step 1. Create a new data frame object called MyData_Filtered AND Step 2: Using the filter function, capture into your new dataframe, only the rows in which Income > 10 AND Income < 200 AND Age > 17 Part B: How many rows remain in your filtered dataframe? **Extra Credit (5pts)** If you can perform complete this using one filter function! ```{r} #Your code goes here. ```
QUESTION 11:Part A: 1. Let's try our scatterplot visualization from Question 9 again. - Remember to include these arguments: size = 3, color=~Age Part B: What do you notice from our new scatterplot? Extra Credit: See if you can add a regression line through the scatter plot ```{r} #Your code goes here! ```
QUESTION 12: Part A: Create another scatter plot, but this time using Income by Age3Cat. - Remember to include these arguments: size = 3, color=~Age Part B: Based on your investigation, does there appear to be an association between age and income? Why or why not? Part C: Because there is an association, does this mean that Age is the cause of higher income? Why or why not? ```{r} #Your code goes here!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started