This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.

CAfires<-read.csv("C:/Users/bcole/Documents/gisfire.csv")
head(CAfires)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
ca_fires<- CAfires %>%
  mutate(acres_cumulative= cumsum(GIS_ACRES))
ca_fires
fires<- ggplot(ca_fires,aes( x = YEAR_, y = acres_cumulative)) +
  geom_line() +
  theme_classic() +
  scale_y_continuous(labels = scales::comma) +
  ylab("Acres Burned (cumulative)")+
  xlab("date") +xlim(1910,2020)
plot(fires)
## Warning: Removed 1341 rows containing missing values (geom_path).

annualfire<-ca_fires %>%
  group_by(YEAR_, ECOREGION_SECTION) %>%
  summarise(Yearlyacres = sum(GIS_ACRES))
annualfire
histogram<-ggplot(annualfire,aes(Yearlyacres))+geom_histogram(aes(y = ..count.., color = ..count.., fill=..count..), breaks=seq(0,2000000, by=100000))+ ggtitle("Acres Burned Annualy")+theme(plot.title = element_text(hjust=0.5))+ylab("# of years")+xlab("Annual Acres Burned") 
ggplotly(histogram)
## Warning: Removed 1 rows containing non-finite values (stat_bin).
options(scipen=10000)
annualfire<-ggplot(annualfire, aes(x=YEAR_, y=Yearlyacres, fill=Yearlyacres))+geom_bar(stat="identity")+ylab("Annual Fire Area (Acres)")+xlab("Year")+ggtitle("Burned Area by Year: California")+xlim(1910,2020)+facet_wrap(~ECOREGION_SECTION)
ggplotly(annualfire)
## Warning: Removed 26 rows containing missing values (position_stack).

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.