Sample R codes for reference