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 matrix elements.

set <- function(a) {

x <<- a

m <<- NULL

}

Function to get matrix data

get <- function() x

Function to set the inverse

setInverse <- function(inverse) m

Function to get the inverse

getInverse <- function() m

Return a list with the above four functions

list(set = set, get = get, setInverse = setInverse, getInverse = getInverse)

}

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, …) {

Return a matrix that is the inverse of ‘x’

m <- x$getInverse()

##Check if data has been cached

if(!is.null(m)) {

message(“getting cached data”)

return(m)

}

Data was not cached.

data <- x$get()

m <- solve(data, …)

x$setInverse(m)

return(m)

```

R Markdown

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: