R sample works