It sounds like you are thinking like an economist to me.

If one cannot see staying in the same place for at least five years, renting is better than buying.

And yes, whatever rent/mortgage payment one is making, they have be affordable in relation to one's income.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store