Time-Series with UKgas

#1
Hello,
i have a problem with the seasonal component.

y <- UKgas
p <- 4

if(!p%%2==1) {
x <- filter(y,rep(1/p,p))
} else {
x <- filter(y,c(0.5,rep(1,p-1),0.5)/p) #Berechnung der geglätteten Zeitreihe
}

d_t <- y-x #Trendbereinigte Zeitreihe
f <- matrix(d_t, 27, 4, byrow=TRUE)
mittel <- mean(f, na.rm = TRUE)
s_t <- apply(f,2, na.rm = TRUE, mean) #Schätzung der Saisonkomponenten
y_t <- y-s_t #Berechnung der saisonbereinigte Zeitreihe

Solution from the prof
seasonal component
175.13810 -36.14123 -168.96767 29.97079

My Solution:

175.08173 -36.48611 -172.58750 28.85288

( commentary are in German )

what did I wrong?