ex2.R Final