Added plot4 and updated other R codes