RCode for doing some analysis