10 Matching Annotations
  1. Apr 2021
    1. No exercises

      Thanks ever so much for this amazing set of solutions. I learned as much from this as from the R4DS textbook. I just made a donation to the kākāpō recovery (as suggested by the r4ds online version) and would be happy to make a similar donation to any charity of your choice. Just let me know what cause you'd like me to support. Thanks again for your awesome work!

    1. "Terms of US Presdients", subtitle = "Roosevelth

      Nothing important, but a couple of typos here: "Presdients" and "Roosevelth". The latter should be Eisenhower (as in the y-axis).

    1. I use arrange() and slice() to select the largest twenty diamonds

      I guess an alternative would be to drop "arrange()" and use the slice_max() function instead? That is, slice_max(carat, n = 20, with_ties = FALSE).

  2. Feb 2021
    1. The lyrics for Ten in the Bed are

      We're asked to convert the lyrics to a function that can be generalised to any number of people in the bed. Isn't the following closer to answering the question fully:

      library(english)

      ten_bed <- function(x) { lyric_1 <- c("There were ") lyric_2 <- c(" in the bed And the little one said, “Roll over! Roll over!” So they all rolled over and one fell out\n") number <- as.character(as.english(x:1))

      for (i in number) { if (i != "one") { cat(lyric_1) cat(i) cat(lyric_2) cat("\n") } else { cat("There was one in the bed And the little one said, “Alone at last!” “Good Night!”") } } }

      ten_bed(x)

  3. Nov 2020
  4. May 2020
    1. Words that contain only consonants

      An alternative: str_view(words, "[aeiou]", match = FALSE)

      Or, using str_subset: str_subset(words, "[aeiou]", negate = TRUE)

    1. foreign

      If one adds "%>% distinct(dest)" to the expression, one sees that there are four airports that are not in the FAA list: BQN, SJU, STT, and PSE. Three of these are in Puerto Rico, one (STT) is in US Virgin Islands.

    2. precipitation

      Perhaps the association with visibility is even stronger.

  5. Apr 2020
    1. They may be combining different flights?

      It seems to refer to diverted flights. The original BTS data also has diverted airport information, including a variable DivArrDelay with the following description: "Difference in minutes between scheduled and actual arrival time for a diverted flight reaching scheduled destination. The ArrDelay column remains NULL for all diverted flights." I browsed this data quickly and, indeed, those missing arr_delay observations have values in the DivArrDelay variable.