Apart from all this. Shifting from R to D, D to R, R to P when the car is even in slightest motion is not at all to be done. I read somewhere that it will damage transmission.
The correct way is to let the car come to a complete stop. If there is a slightest motion and you shift to opposite direction the transmission is being forced to move in an opposite direction to the wheels during that instant. So better avoid. Come to a complete stop before shifting direction modes. Those last few seconds are important when stopping and shifting.
Also whenever you park your car always engage the parking brake before removing your foot off the brake when car has been shifted in P. When shifted to P and If you remove your foot first, the load of keeping th car stationary shifts entirely onto the transmission. This can be observed sometimes when it takes a harder jerk or noise while shifting out of P on inclines or ramps. So always first enage parking brake and then remove your foot from brake.
I have seen many people just leaving their cars in P and not bothering with the parking brake at all saying: jab P main hai gari toh aik tarah ki gear main hai kya zaroorat hand brake ki. Well thats an absolute wrong practice in my opinion. If that was the case why have the car companies bothered to give parking brakes at all? They are there for a reason. Not for decoration. Getting into P doesn't make it engage automatically