update R script for ploting charts