19 Practice

19.1 starwars Excercises

Please use the starwars dataset from the dplyr package to answer the following questions:

  1. How may humans are in this dataset?
  2. How many characters are taller than 89 cm?
  3. How many characters are taller than 37 inches?
  4. How many characters are taller than 37 inches and weigh more than 55 pounds?
  5. How many characters are not human or droid?
  6. How many characters are not human or droid and are taller than 47 inches?
  7. Which species has the most individuals included in this data set?
  8. Which species has the tallest individuals on average?
  9. What is the tallest individual for each species?
  10. Calculate the BMI for each individual and determine which individual has the highest BMI. Use the formula bmi = mass/((height/100)^2) to calculate bmi.
  11. Which homeworld has the most individuals included in this data set?
  12. Which homeworld has the tallest individuals on average?
  13. What is the tallest individual for each eye color?

19.2 iris Excercises

Please use the iris dataset from base R to answer the following questions:

  1. How many “virginica” have a petal width of 2.3 or greater in this dataset?
#>    n
#> 1 14
  1. What is the average petal width for each species?
#> # A tibble: 3 × 2
#>   Species    avg.petal.width
#>   <fct>                <dbl>
#> 1 setosa               0.246
#> 2 versicolor           1.33 
#> 3 virginica            2.03
  1. How many observations of each species have a petal width of 2.3 or greater in this dataset?
#> # A tibble: 1 × 2
#>   Species       n
#>   <fct>     <int>
#> 1 virginica    14
  1. How many observations of each species have a petal width of 0.5 or greater in this dataset?
#> # A tibble: 3 × 2
#>   Species        n
#>   <fct>      <int>
#> 1 setosa         2
#> 2 versicolor    50
#> 3 virginica     50

19.3 More practice

Using the flights data answer:

  1. How many different destinations are in the flights data?
  2. Which destination has the most flights?
  3. How many origin airports are in the state of sick, and which has the most flights?
  4. Which month of the year has the most flights? The least?
  5. Which Carrier has the longest average flight?
  6. Which carrier has the most flights in the month of October leaving from Newark?
  7. What percentage of June flights arrive late?
  8. Which carrier has the most late flights in the month of December?
  9. This one is hard: for flights leaving JFK, which airline has the greatest percentage of late flights?
  10. Think of a question that you could ask about this data. What’s the question, and what’s the answer?

19.4 Yet more practice

Using the iris data answer:

  1. How many flowers are species “virginica” and have a Sepal.Length greater than 7.5?
  2. Create a new variable called Sepal.Area with is: Sepal.Area = Sepal.Width * Sepal.Length
  3. What is the maximum new Sepal.Area?
  4. Calculate the average Sepal.Area for each species and organize these values in descending order.
  5. Find the minimum Sepal.Area for each species and organize these values in descending order.
  6. How many flowers of each species have Sepal.Area of less than 15?
  7. What is the mean sepal length for flowers with a Sepal. Area of less than 15?