Comments (3)
Put comments here that give an overall description of what your
functions do
Write a short comment describing this function
makeCacheMatrix <- function(x = matrix()) {
inv <- NULL ## initialize inv as NULL; will hold value of inverse matrix
set <- function(y) { ## set to assign new function
x <<- y ## value of matrix in parent environment
inv <<- NULL ## if there is a new matrix, reset inv to NULL
}
get <- function() {x} ## define the get function - returns value of the matrix argument
setInverse <- function(inverse) {inv <<- inverse} ## assigns value of inv in parent environment
getInverse <- function() {inv} ## gets the value of inv where called
list(set = set, get = get, setInverse = setInverse, getInverse = getInverse)
}
Write a short comment describing this function
cacheSolve <- function(x, ...) {
## Return a matrix that is the inverse of 'x'
inv <- x$getInverse()
if(!is.null(inv)) { ## if inverse has not been already cached, it is cached and collected
message("cached data collected")
return(inv)
}
m <- x$get()
assignmentprogramming2.txt
}
from programmingassignment2.
makeCacheMatrix <- function(x = matrix()){
inv <- NULL
set <- function(y){
x<<- y
inv<<- NULL
}
get <- function() x
setInv <- function(inverse) inv<<- inverse
getInv <- function() inv
list(set = set, get = get,
setInv = setInv,
getInv = getInv)
}
cacheSolve
cacheSolve <- function(x, ...){
inv <- x$getInv()
if(!is.null(inv)){
message('getting cached data')
return(inv)
}
matrix <- x$get()
inv <- mean(matrix,...)
x$setInv(inv)
inv
}
from programmingassignment2.
makeCacheMatrix <- function(x = matrix()){
inv <- NULL
set <- function(y){
x<<- y
inv<<- NULL
}
get <- function() x
setInv <- function(inverse) inv<<- inverse
getInv <- function() inv
list(set = set, get = get,
setInv = setInv,
getInv = getInv)
}
cacheSolve
cacheSolve <- function(x, ...){
inv <- x$getInv()
if(!is.null(inv)){
message('getting cached data')
return(inv)
}
matrix <- x$get()
inv <- mean(matrix,...)
x$setInv(inv)
inv
}
from programmingassignment2.
Related Issues (20)
- .
- WEEK 3 ASSIGNMENT
- not cloning
- Hi I make a html and I ready a we page pls tell how to start it like subbmit I didn't get notifications
- Want programing on me all day timely
- #hi wolrled
- Assignment
- Asudeweek3assginmentlexicalscoping
- Programming assignment ERASTUS WANYAMA
- new
- ysy_assignment
- assignment
- Python programming assignment 1
- Wang Xiaohan ProgrammingAssignment2
- ProgrammingAssignment2 HOT 1
- G
- I'm new here
- How do i get the assignment token please? for Week 3 (peer reviewed assignment) Programming Assignment 2: Lexical Scoping
- Assignment 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from programmingassignment2.