Here is the answer to your question after providing me with the data and a bit more explanation in private messages:
# Load dplyr
library(dplyr)
# Download the full data
cost <- read.csv("diff_in_diff/cost_data.csv.csv")
# Compute the mean outcome by year and by treatment
cost %>%
group_by(year, treatment) %>%
summarize(avg_Y = mean(Y, na.rm = TRUE))
# A tibble: 14 x 3
# Groups: year [7]
year treatment avg_Y
<int> <int> <dbl>
1 2005 0 5774.
2 2005 1 5294.
3 2006 0 5853.
4 2006 1 5400.
5 2007 0 5887.
6 2007 1 5436.
7 2008 0 6141.
8 2008 1 5367.
9 2009 0 6151.
10 2009 1 5389.
11 2010 0 6069.
12 2010 1 5321.
13 2011 0 5869.
14 2011 1 5195.