Diversi script in R