Fixed R commands so it works with R version 3.2