4  Summary

In summary, this book has no content whatsoever.

1 + 1
[1] 2
dat$hour12 <- format( date.vec, format="%l %p" )
table( dat$hour12 ) %>% head() %>% pander()

# set the levels so they are in the correct order
time.levels <-
  c( "12 AM", " 1 AM", " 2 AM", " 3 AM", " 4 AM", " 5 AM", 
     " 6 AM", " 7 AM", " 8 AM", " 9 AM", "10 AM", "11 AM", 
     "12 PM", " 1 PM", " 2 PM", " 3 PM", " 4 PM", " 5 PM", 
     " 6 PM", " 7 PM", " 8 PM", " 9 PM", "10 PM", "11 PM" )

dat$hour12 <- factor( dat$hour12, levels=time.levels )
table( dat$hour12 ) %>% head() %>% pander()
qplot( data=d3, x=as.numeric(as.character(hour)), y=harm ) + 
  geom_line( color="steelblue", size=0.8 ) + 
  geom_point( color="darkblue", size=3 ) + 
  geom_hline( yintercept=mean.harm, color="black" ) + 
  facet_wrap( ~ age, ncol=4 ) + 
  xlab("Time of Day (24hrs)") + ylab("Rate of Harm") +
  ggtitle("Proportion of Accidents Resulting in Harm") +
  # theme_fivethirtyeight() 
  theme_wsj( base_size=10, color="gray" )