How to program in R for statistical analysis in engineering