R programming and package creation