We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 831f11b commit fe5ccd6Copy full SHA for fe5ccd6
cachematrix.R
@@ -20,8 +20,30 @@ makeCacheMatrix <- function(x = matrix()) {
20
21
cacheSolve <- function(x, ...) {
22
## Return a matrix that is the inverse of 'x'
23
+ inverseX <- x$getInverse();
24
+ if(!is.null(inverseX)){
25
+ message("getting cached data")
26
+ return(inverseX)
27
+ }
28
+ matrix <- x$get()
29
+ inverseX <-slove(matrix)
30
+ x$setInverse(inverseX)
31
+ inverseX
32
}
33
34
+cachemean <- function(x, ...) {
35
+ m <- x$getmean()
36
+ if(!is.null(m)) {
37
38
+ return(m)
39
40
+ data <- x$get()
41
+ m <- mean(data, ...)
42
+ x$setmean(m)
43
+ m
44
+}
45
+
46
47
makeVector <- function(x = numeric()) {
48
m <- NULL
49
set <- function(y) {
0 commit comments