# Load necessary packages
library(ggplot2)
library(dplyr)
library(nycflights13)
# Load weather data set in nycflights
data(weather)
ggplot(data = weather, aes(x = temp)) +
geom_histogram(bins = 30)
ggplot(data = weather, aes(x = temp)) +
geom_histogram(bins = 60)
temp
variabile by View(weather)
, we see that the precision of each temperature recording is 2 decimal places.summary()
command, we see that the mean and median are very similar. In fact, when the distribution is symmetric the mean equals the median.summary(weather$temp)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 10.94 39.92 55.04 55.20 69.98 100.00 1
While, it appears that Seattle weather has a similar center of 55°F, its temperatures are almost entirely between 35°F and 75°F for a range of about 40°F. Seattle temperatures are much less spread out than New York i.e. much more consistent over the year. New York on the other hand has much colder days in the winter and much hotter days in the summer.
Expressed differently, the middle 50% of values, as delineated by the interquartile range is 30°F:
IQR(weather$temp, na.rm=TRUE)
## [1] 30.06