Final version of caching matrix R code