R Code of data analysis