Question
Question 1 Use the starwars dataset from the dplyr package i)Conduct the following to get a final tibble called summary. a. Remove the missing values
Question 1
Use the starwars dataset from the dplyr package
i)Conduct the following to get a final tibble called summary.
a. Remove the missing values from species.
b. Then, obtain the mean and median height and mass for each species. Use the functions summarise() and across() to obtain this.
c. Include an argument in the across function to name the new columns starting with the function name followed by an underscore and then the column name (e.g.: mean_height).
d. Assign the results to a tibble named summary.
e. Print summary. (6 marks)
ii) Use the results in (i) and select only the species and mean_height variables. Then arrange from highest to lowest.
Print the outputfor the first 10 observations.(4 marks)
iii) Use the original starwars datasetfrom the dplyr package and conduct the following:
a. Remove the missing values from species.
b. Group the data by gender and then species.
c. Then obtain the mean values of height and sort from highest to lowest for the masculine group and also from highest to lowest for the feminine group.
d. Finally extract the top three tallest groups for the masculine group and for the feminine group.
Print out this output which will have 6 observations. (5marks)
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