7.3 SIRs
\[SIR_{ij}=\frac{Y_{ij}}{E_{ij}}\]
$SIR <- d$Y / d$E
dhead(d)
## county year Y E SIR
## 1 Adams 1968 6 8.278660 0.7247549
## 2 Adams 1969 5 8.501767 0.5881130
## 3 Adams 1970 9 8.779313 1.0251372
## 4 Adams 1971 6 9.175276 0.6539313
## 5 Adams 1972 10 9.548736 1.0472591
## 6 Adams 1973 7 10.099777 0.6930846
<- d%>%
dw pivot_wider(names_from=year,values_from = c("Y","E","SIR"))
head(dw)
## # A tibble: 6 × 64
## county Y_1968 Y_1969 Y_1970 Y_1971 Y_1972 Y_1973 Y_1974 Y_1975 Y_1976 Y_1977
## <chr> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
## 1 Adams 6 5 9 6 10 7 12 12 10 7
## 2 Allen 32 33 39 44 36 38 41 35 54 63
## 3 Ashland 15 19 12 12 12 11 12 18 15 15
## 4 Ashtabu… 27 24 25 37 44 29 37 26 40 41
## 5 Athens 12 9 12 12 28 23 11 20 25 18
## 6 Auglaize 7 10 8 16 6 15 12 12 20 18
## # … with 53 more variables: Y_1978 <int>, Y_1979 <int>, Y_1980 <int>,
## # Y_1981 <int>, Y_1982 <int>, Y_1983 <int>, Y_1984 <int>, Y_1985 <int>,
## # Y_1986 <int>, Y_1987 <int>, Y_1988 <int>, E_1968 <dbl>, E_1969 <dbl>,
## # E_1970 <dbl>, E_1971 <dbl>, E_1972 <dbl>, E_1973 <dbl>, E_1974 <dbl>,
## # E_1975 <dbl>, E_1976 <dbl>, E_1977 <dbl>, E_1978 <dbl>, E_1979 <dbl>,
## # E_1980 <dbl>, E_1981 <dbl>, E_1982 <dbl>, E_1983 <dbl>, E_1984 <dbl>,
## # E_1985 <dbl>, E_1986 <dbl>, E_1987 <dbl>, E_1988 <dbl>, SIR_1968 <dbl>, …