Started working on R script for sparse matrix