Create cachematrix with error handling.R