Skip to content

R programming assignment2 by Felipe Cigarroa #4573

Open
@Phil-DataScientist-s

Description

@Phil-DataScientist-s

##makeCacheMatrix:
##This function creates a special “matrix” object that can cache its inverse.

makeCacheMatrix <- function(x = matrix()){
m <- NULL
set <- function(y){
x <<- y
m <<- NULL
}
get <- function()x
setresolver <- function(solve) m <<- solve
getresolver <- function() m
list(set = set,
get = get,
setresolver = setresolver,
getresolver = getresolver)
}

##cacheSolve:
##This function computes the inverse of the special “matrix” returned by makeCacheMatrix above.
##If the inverse has already been calculated (and the matrix has not changed),
##then the cacheSolve should retrieve the inverse from the cache.
cacheSolve <- function(x, ...){
m <- x$getresolver()
if(!is.null(m)) {
message("obtener datos en caché")
return(m)
}
data <- x$get()
m <- solve(data, ...)
x$setresolver(m)
m
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions