A brief exploration of Texas vaccination rates among kindergartners. Also an attempt to use rayshader for the first time.
Load Packages
Read in Data
Facility Number
School Type
Facility Name
Facility Address
County
DTP/DTaP/DT/Td
Hepatitis A
Hepatitis B
MMR
Polio
Varicella
9057816000
Public ISD
A W Brown Leadership Academy
5701 RED BIRD CTR DR, DALLAS, TX, 75237
Dallas
0.8317308
0.9086538
0.9471154
0.8509615
0.8413462
0.8509615
9057829000
Public ISD
A+ Academy
8225 BRUTON RD, DALLAS, TX, 75217
Dallas
1.0000000
1.0000000
1.0000000
0.9909091
1.0000000
1.0000000
9109901000
Public ISD
Abbott ISD
P O BOX 226, ABBOTT, TX, 76621
Hill
1.0000000
1.0000000
1.0000000
1.0000000
1.0000000
1.0000000
7101130101
Private School
Abercrombie Academy
17102 Theiss Mail Road, Spring, TX, 77379
Harris
1.0000000
1.0000000
1.0000000
0.7500000
1.0000000
0.7500000
9095901000
Public ISD
Abernathy ISD
505 7TH ST, ABERNATHY, TX, 79311
Hale
1.0000000
1.0000000
1.0000000
1.0000000
1.0000000
1.0000000
7101220001
Private School
Abiding Word Lutheran School
17123 Red Oak Drive, Houston, TX, 77090
Harris
0.7692308
0.7692308
0.7692308
0.7692308
0.6923077
0.7692308
The data contains information on six different vaccines split up by school. The set also contains information on the county of each school, allowing us to aggregate on the county level. By finding the average of the six vaccines listed in this dataset, we can see average vaccination rate by county:
subregion
avgvac
anderson
0.9676797
andrews
0.9715335
angelina
0.9693150
aransas
0.9735294
archer
0.9915167
armstrong
0.9677419
Next, we read in the county-level data from ggplot2 and merge it with our vaccination data:
Plot
Construct the plot using geom_polygon(), and pay special attention to theme attributes (axes, panels, etc.).
Unfortunately, theme_nothing() led to some conflicts with rayshader, so I essentially recreated it using theme() attributes.
Here’s what the plot looks like before animation:
Rayshader
Load in rayshader and rgl. I’m not sure if rgl is necessary for all R users, but I ran into a few errors on my system (Mac) prior to its installation.
Lastly, create the plot_gg() object by following the comprehensive documentation on Wall’s README.