title: “Function_Matrix3” author: “Elimane NDOYE” date: “25/05/2019” output: html_document —{r setup, include=FALSE} knitr::opts_chunk\(set(echo = TRUE, results = "asis") makeCacheMatrix <- function(x, ...) { m <- x\)getmean() if(!is.null(m)) { message(“getting cached data”) return(m) } data <- x\(get() m <- mean(data, ...) x\)setmean(m) m }
cacheSolve <- function(x, …) { m <- x\(getmean() if(!is.null(m)) { message("getting cached data") return(m) } data <- x\)get() m <- mean(data, …) x$setmean(m) m } ## This function creates a special “matrix” object that can cache its inverse
makeCacheMatrix <- function(x = matrix()) {
m <- NULL
set <- function(a) {
x <<- a
m <<- NULL
}
get <- function() x
setInverse <- function(inverse) m
getInverse <- function() m
list(set = set, get = get, setInverse = setInverse, getInverse = getInverse)
}
cacheSolve <- function(x, …) {
m <- x$getInverse()
##Check if data has been cached
if(!is.null(m)) {
message(“getting cached data”)
return(m)
}
data <- x$get()
m <- solve(data, …)
x$setInverse(m)
return(m)
```
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this: