rdpeng / ProgrammingAssignment2

Repository for Programming Assignment 2 for R Programming on Coursera
836 stars 143.51k forks source link

Assignment_2 Lisa Sheremet #3259

Open lisasheremet opened 6 years ago

lisasheremet commented 6 years ago

Setting the matrix

makeCacheMatrix <- function(x = matrix()) { inv <- NULL set <- function(y){ x <<- y inv <<- NULL } get <- function() x setInverse <- function(solveMatrix) inv <<- solveMatrix getInverse <- function() inv list(set = set, get = get, setInverse = setInverse, getInverse = getInverse) }

Creating a function caching an inverse matrix

cacheSolve <- function(x, ...) {

Return a matrix that is the inverse of 'x'

inv <- x$getInverse() if(!is.null(inv)){ message("getting cached data") return(inv) } data <- x$get() inv <- solve(data) x$setInverse(inv) inv
}

eyecondon commented 6 years ago

Looks great from what i can tell...