added csv and some changes of options of r code