Description
Question 3: You are interested in understanding the demographics of a particular cohort in your data set: those who have a bachelor’s degree or higher whose occupation is also “Exec-managerial.” (Hint: First write code to subset those with occupational category of “Exec-managerial,” then write code to subset for educational level.) Use the appropriate R function(s) to report the count of individuals who meet these criteria along with their average age and the percentage who earn more than $50,000 annually. Include a screenshot of the R console output as part of the answer.
Question 4: Using the Age variable, create a new variable that divides Age into age categories. Your categories should be as follows: Under 25; 25-34; 35-44; 45-54; 55-64; 65+. The code to create the first category would be as follows:
incomedat$age_cat[incomedat$Age < 25] <- “<25”
Use this line of code as a template to create the other categories. Ensure that your code worked by showing a table with the age categories and the counts of individuals in each category.
Question 5: Create a cross tab showing the count of customers in each age bracket who earn more than $50,000 annually. Use the appropriate R function(s) to calculate the percentage of customers who earn more than $50,000 annually for each age bracket. Include a screenshot of the R console output as part of the answer. Which age category has the highest percentage of individuals that earn over $50k?