f(R) gravity and chameleon theories