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