f(R) gravity with torsion: the metric affine approach