library(tidyverse)
## -- Attaching packages ----------------------------------------------------------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2 v purrr 0.3.4
## v tibble 3.0.1 v dplyr 1.0.0
## v tidyr 1.1.0 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.5.0
## -- Conflicts -------------------------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
setwd( "C:/Users/Jerome/Documents/Data_Science_110/Datasets")
lcn_final_person_file <- read.csv("lcn_final_person_file", header = TRUE)
year_2007 <- filter (lcn_final_person_file, Svy_Year == 2007)
year_2013 <- filter (lcn_final_person_file, Svy_Year == 2013)
write.csv (year_2007, file = "year_2007")
write.csv (year_2013, file = "year_2013")
## Try the plot
library(RColorBrewer)
data("lcn_final_person_file")
## Warning in data("lcn_final_person_file"): data set 'lcn_final_person_file' not
## found
the_measure <- "Child Nutrition"
lcn_final_person_file %>%
ggplot(aes(Svy_Year, County, fill = MEASURE)) +
geom_tile(color = "grey50") +
scale_x_continuous(expand=c(0,0)) +
scale_fill_gradientn(colors = brewer.pal(9, "Reds"), trans = "sqrt") +
geom_vline(xintercept=2007, col = "blue") +
theme_minimal() + theme(panel.grid = element_blank()) +
ggtitle(the_measure) +
ylab("") +
xlab("")
## Read the file with County Names
lcn_fpf_co_names <- read.csv("lcn_fpf_co_names.csv", header = TRUE)
## Try the plot with County Names
library(RColorBrewer)
data("lcn_fpf_co_names")
## Warning in data("lcn_fpf_co_names"): data set 'lcn_fpf_co_names' not found
the_measure <- "Child Nutrition"
lcn_fpf_co_names %>%
ggplot(aes(Svy_Year, Co_Name, fill = MEASURE)) +
geom_tile(color = "grey50") +
scale_x_continuous(expand=c(0,0)) +
scale_fill_gradientn(colors = brewer.pal(9, "Reds"), trans = "sqrt") +
geom_vline(xintercept=2007, col = "blue") +
theme_minimal() + theme(panel.grid = element_blank()) +
ggtitle(the_measure) +
ylab("") +
xlab("")