added four R codes and corresponding graphs