diff --git a/cachematrix.R b/cachematrix.R index 462ed40c923..4b45237dacd 100644 --- a/cachematrix.R +++ b/cachematrix.R @@ -1,11 +1,9 @@ ## Pair of functions that cache the inverse of a matrix -## Usage: Pass the result of a makeCacheMatrix call to cacheSolve +#Usage: Pass the result of a makeCacheMatrix call to cacheSolve #' Util function that set the matrix and the inverse in an environment #' @param x an invertible matrix -#' examples -#' x = makeCacheMatrix(matrix(rnorm(9), 3, 3)) -#' x$set(matrix(rnorm(16), 4, 4)) + makeCacheMatrix <- function(x = matrix()) { # todo error if x is not a matrix inv <- NULL @@ -25,9 +23,7 @@ makeCacheMatrix <- function(x = matrix()) { #' Compute and cache the inverse of a matrix #' @param x the result of a previous makeCacheMatrix call #' @param ... additional arguments to pass to solve function -#' examples -#' x = makeCacheMatrix(matrix(rnorm(9), 3, 3)) -#' cacheSolve(x) + cacheSolve <- function(x, ...) { ## Return a matrix that is the inverse of 'x' inv <- x$getinverse()