How To Use Sample Function In R