How long should I keep a vehicle?

Determine the better option: keeping a vehicle for a long time or selling and buying a new vehicle more often.