select
congress,
datepart('year', termstart) as year,
party,
ROUND(median(age), 1) as "median age",
ROUND(mean(age), 1) as "mean age"
from @fivethirtyeight.congress_age.congress_terms
where year >= 1980 and party = 'R'
group by congress, year, party
order by year