Caching a matrix for coursera R