R sample codes