codes in R for DATA analysis