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 Cmd+Shift+Enter.

library(tidyverse)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag():    dplyr, stats
library(ggstance)
## 
## Attaching package: 'ggstance'
## The following objects are masked from 'package:ggplot2':
## 
##     geom_errorbarh, GeomErrorbarh
a19 <- read_csv("~/Desktop/a19.csv") %>%
  filter(!(Category %in% c("Governance", "Fundraising", "Law and policy"))) %>%
  group_by(Year, Category) %>%
  summarise(Amount = sum(Amount))
## Parsed with column specification:
## cols(
##   Year = col_integer(),
##   Subcategory = col_character(),
##   Category = col_character(),
##   Amount = col_integer()
## )
ggplot(a19, aes(x=Year, y=Amount, colour=Category)) +
  geom_line() +
  guides(colour=guide_legend(title=NULL)) +
  labs(x=NULL, y=NULL,
       title="Article 19 annual expenditures on regional programs",
       caption="Source: 2011–2015 annual reports") +
  scale_y_continuous(labels=scales::dollar_format(prefix="£")) +
  theme_light(base_family="Source Sans Pro") +
  theme(legend.position="bottom")

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Cmd+Option+I.

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