- Apr 2021
-
jrnold.github.io jrnold.github.io
-
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!
-
-
jrnold.github.io jrnold.github.io
-
"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).
-
-
jrnold.github.io jrnold.github.io
-
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).
-
- Feb 2021
-
jrnold.github.io jrnold.github.io
-
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)
-
- Nov 2020
-
jrnold.github.io jrnold.github.io
-
sum(sq_err)
Doesn't one also need to add "na.rm = TRUE" here?
-
- May 2020
-
jrnold.github.io jrnold.github.io
-
Words that contain only consonants
An alternative: str_view(words, "[aeiou]", match = FALSE)
Or, using str_subset: str_subset(words, "[aeiou]", negate = TRUE)
-
-
jrnold.github.io jrnold.github.io
-
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.
-
precipitation
Perhaps the association with visibility is even stronger.
-
-
jrnold.github.io jrnold.github.io
-
on
only
-
- Apr 2020
-
jrnold.github.io jrnold.github.io
-
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.
-