{"comment":{"url":"https://api.github.com/repos/mehrishisam/ProgrammingAssignment2/comments/11786276","html_url":"https://github.com/mehrishisam/ProgrammingAssignment2/commit/68f22e6da4bbfdac336d41e47154c56ffc58bb25#commitcomment-11786276","id":11786276,"user":{"login":"mehrishisam","id":8681475,"avatar_url":"https://avatars.githubusercontent.com/u/8681475?v=3","gravatar_id":"","url":"https://api.github.com/users/mehrishisam","html_url":"https://github.com/mehrishisam","followers_url":"https://api.github.com/users/mehrishisam/followers","following_url":"https://api.github.com/users/mehrishisam/following{/other_user}","gists_url":"https://api.github.com/users/mehrishisam/gists{/gist_id}","starred_url":"https://api.github.com/users/mehrishisam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehrishisam/subscriptions","organizations_url":"https://api.github.com/users/mehrishisam/orgs","repos_url":"https://api.github.com/users/mehrishisam/repos","events_url":"https://api.github.com/users/mehrishisam/events{/privacy}","received_events_url":"https://api.github.com/users/mehrishisam/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"68f22e6da4bbfdac336d41e47154c56ffc58bb25","created_at":"2015-06-22T01:19:55Z","updated_at":"2015-06-22T01:19:55Z","body":" ## functions do\r\n \r\n ## Write a short comment describing this function\r\n-\r\n+## The function below creates a function that inverts a matrix for a given input\r\n makeCacheMatrix <- function(x = matrix()) {\r\n-\r\n+ m<-NULL\r\n+  set<-function(y){\r\n+        x<<-y\r\n+        m<<-NULL\r\n+  }\r\n+  get <-function() x\r\n+  setinverse<-function(solve) m<<-solve\r\n+  getinverse<-function() m\r\n+  list(set=set,get=get,setinverse=setinverse,getinverse=getinverse)\r\n }\r\n \r\n \r\n ## Write a short comment describing this function\r\n-\r\n+## The function below uses value of m to evaluate if matrix is inverted, if not it calls the invert function and inverts the matrix\r\n cacheSolve <- function(x, ...) {\r\n+m<-x$getinverse()\r\n+  if(!is.null(m)){\r\n+       message(\"getting cached data\")\r\n+       return(m)\r\n+  }\r\n+  data <-x$get()\r\n+  m<-solve(data,...)\r\n+  x$setinverse(m)\r\n         ## Return a matrix that is the inverse of 'x'"}}