Petra Lamborn 4 years ago
parent
commit
9cf95b86b0
2 changed files with 3 additions and 1 deletions
  1. BIN
      Missing2018.png
  2. 3
    1
      expl.R

BIN
Missing2018.png View File


+ 3
- 1
expl.R View File

19
 str(dat)
19
 str(dat)
20
 
20
 
21
 yeartab <- table(dat$CRASH_YEAR)
21
 yeartab <- table(dat$CRASH_YEAR)
22
-mpy <- mean(yeartab)
22
+mpy <- sum(yeartab)/(18.75)
23
 
23
 
24
 # Obviously, data missing from 2018
24
 # Obviously, data missing from 2018
25
 ggplot(dat) + geom_bar(aes(x=CRASH_YEAR), fill=NA, col="black") +
25
 ggplot(dat) + geom_bar(aes(x=CRASH_YEAR), fill=NA, col="black") +
43
   theme_classic() + labs(x = "Crash severity", y = "Number of crashes") +
43
   theme_classic() + labs(x = "Crash severity", y = "Number of crashes") +
44
   scale_y_continuous(labels = scales::comma)
44
   scale_y_continuous(labels = scales::comma)
45
 
45
 
46
+knitr::kable(table(dat$MULTI_VEH, dat$CRASH_SEV))
47
+
46
 # Not all openroad crashes are on state highways
48
 # Not all openroad crashes are on state highways
47
 table(dat$URBAN, dat$CRASH_SH_DESC)
49
 table(dat$URBAN, dat$CRASH_SH_DESC)
48
 
50