8.7 Test your R might! Pirates and superheroes
The following table shows the results of a survey of 10 pirates. In addition to some basic demographic information, the survey asked each pirate “What is your favorite superhero?”” and “How many tattoos do you have?””
Name | Sex | Age | Superhero | Tattoos |
---|---|---|---|---|
Astrid | F | 30 | Batman | 11 |
Lea | F | 25 | Superman | 15 |
Sarina | F | 25 | Batman | 12 |
Remon | M | 29 | Spiderman | 5 |
Letizia | F | 22 | Batman | 65 |
Babice | F | 22 | Antman | 3 |
Jonas | M | 35 | Batman | 9 |
Wendy | F | 19 | Superman | 13 |
Niveditha | F | 32 | Maggott | 900 |
Gioia | F | 21 | Superman | 0 |
Combine the data into a single dataframe. Complete all the following exercises from the dataframe!
What is the median age of the 10 pirates?
What was the mean age of female and male pirates separately?
What was the most number of tattoos owned by a male pirate?
What percent of pirates under the age of 32 were female?
What percent of female pirates are under the age of 32?
Add a new column to the dataframe called
tattoos.per.year
which shows how many tattoos each pirate has for each year in their life.Which pirate had the most number of tattoos per year?
What are the names of the female pirates whose favorite superhero is Superman?
What was the median number of tattoos of pirates over the age of 20 whose favorite superhero is Spiderman?