Completed cachematric.R code for programming assignment 2