library(tidyverse)
library(readxl)
library(lubridate)
df  <- read_excel("NG_PROD_SUM_A_EPG0_VGV_MMCF_A.xls",sheet=2,col_names=T,skip=2)
colnames(df) <-c("Date","National","Alaska","Alaska_onshore","Alaska_State","Arkansas","California","Calif_onshore","California_State","Federal_Offshore_Calif","Colorado","Offshore_Gulf_of_Mexico","Kansas","Louisiana","Louisiana_onshore","Louisiana_State","Montana","New_Mexico","North_Dakota","Ohio","Oklahoma","Pennsylvania","Texas","Texas_onshore","Texas_State_Offshore","Utah","West_Virginia","Wyoming") 
df$Year  <- year(df$Date)
df  <- df %>% filter(Year>2013) %>% summarize(Alaska=sum(Alaska,na.rm=TRUE),Arkansas=sum(Arkansas,na.rm=TRUE),California=sum(California,na.rm=TRUE),Colorado=sum(Colorado,na.rm=TRUE),Kansas=sum(Kansas,na.rm=TRUE),Louisiana=sum(Louisiana,na.rm=TRUE),Montana=sum(Montana,na.rm=TRUE),New_Mexico=sum(New_Mexico,na.rm=TRUE),North_Dakota=sum(North_Dakota,na.rm=TRUE),Ohio=sum(Ohio,na.rm=TRUE),Oklahoma=sum(Oklahoma,na.rm=TRUE),Pennsylvania=sum(Pennsylvania,na.rm=TRUE),Texas=sum(Texas,na.rm=TRUE),Utah=sum(Utah,na.rm=TRUE),West_Virginia=sum(West_Virginia,na.rm=TRUE),Wyoming=sum(Wyoming,na.rm=TRUE))
temp1  <- colnames(df)
temp2  <- df %>% as.data.frame %>% t %>% c
graph_dat <- cbind(temp1,temp2)
colnames(graph_dat)  <- c("State","Flaring")
graph_dat  <-  graph_dat %>% as_tibble %>% mutate(Flaring=as.numeric(Flaring)) %>% filter(Flaring>0) 
#ggplot(data=graph_dat,aes(x="",y=Flaring,fill=State)) + geom_bar(stat="identity",width=1)+coord_polar("y",start=0)
ggplot(data=graph_dat,aes(x="",y=Flaring,fill=State))+geom_col(color="black") +coord_polar(theta="y")

