-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCountyStaticReport.Rmd
47 lines (40 loc) · 2.17 KB
/
CountyStaticReport.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## County Counts For 2002-2012
<!-- Point knitr to the underlying code file so it knows where to look for the chunks. -->
```{r, echo=FALSE, message=FALSE}
require(scales)
pathSourceMapFunctions <- file.path(getwd(), "MapFunctions.R")
source(pathSourceMapFunctions)
#This allows knitr to call chunks tagged in the underlying PrototypeCode.R file.
# read_chunk(pathSourceCode)
```
```{r}
#pathInputDirectory <- "F:/Projects/OuHsc/SafeCare/Spatial/SafeCareSpatial/PhiFreeDatasets"
pathInputDirectory <- file.path(getwd(), "PhiFreeDatasets")
pathInputSummaryCounty <- file.path(pathInputDirectory, "CountCountyFortified.csv")
dsValueAllVariables <- read.csv(pathInputSummaryCounty, stringsAsFactors=FALSE)
```
```{r CountPerCapita, fig.width=14, fig.height=7}
dvName <- "CountPerCapitaAnnual" #The number of victims per county population; darker counties have more victims, adjusted for pop
dsValueAllVariables$DV <- dsValueAllVariables[, dvName]
# dsValueAllVariables$DVLabel <- round(dsValueAllVariables$DV, 2) #Keeps leading zeros
dsValueAllVariables$DVLabel <- gsub("^0.", ".",round(dsValueAllVariables$DV,3)) #Remove leading zeros.
MapCounties(dsValueAllVariables, deviceWidth=14)
```
```{r CountPerCapitaRank, fig.width=14, fig.height=7}
dvName <- "CountPerCapitaRank" #The county's rank for the number of victims per county population; darker counties have more victims, adjusted for pop
dsValueAllVariables$DV <- dsValueAllVariables[, dvName]
dsValueAllVariables$DVLabel <- dsValueAllVariables$DV
MapCounties(dsValueAllVariables, deviceWidth=14)
```
```{r Count, fig.width=14, fig.height=7}
dvName <- "Count" #The county's rank for the number of victims per county population; darker counties have more total victims
dsValueAllVariables$DV <- dsValueAllVariables[, dvName]
dsValueAllVariables$DVLabel <- scales::comma(dsValueAllVariables$DV)
MapCounties(dsValueAllVariables, deviceWidth=14)
```
```{r PopTotal, fig.width=14, fig.height=7}
dvName <- "PopTotal" #The county's 2010 census population; darker counties have more people
dsValueAllVariables$DV <- dsValueAllVariables[, dvName]
dsValueAllVariables$DVLabel <- scales::comma(dsValueAllVariables$DV)
MapCounties(dsValueAllVariables, deviceWidth=14)
```