Update cachematrix.R#4
Open
pratheeshnp wants to merge 1 commit into
Open
Conversation
pursh2002
referenced
this pull request
in pursh2002/ProgrammingAssignment2
Dec 16, 2014
jpavkov
added a commit
to jpavkov/ProgrammingAssignment2
that referenced
this pull request
Dec 19, 2014
borispetukhov
added a commit
to borispetukhov/ProgrammingAssignment2
that referenced
this pull request
Feb 22, 2015
russellding
referenced
this pull request
in russellding/ProgrammingAssignment2
Jul 25, 2015
013b5b79
pushed a commit
to 013b5b79/ProgrammingAssignment2
that referenced
this pull request
Oct 14, 2015
Edit rdpeng#4
sharthee
pushed a commit
to sharthee/ProgrammingAssignment2
that referenced
this pull request
Oct 23, 2015
fixed vote number typo in get_senate_vote function spec
janekdb
added a commit
to janekdb/ProgrammingAssignment2
that referenced
this pull request
Feb 23, 2016
terrebonne
added a commit
to terrebonne/ProgrammingAssignment2
that referenced
this pull request
Aug 9, 2016
…s inverse. #1. set value of the matrix rdpeng#2. get value of the matrix rdpeng#3. set value of the inverse rdpeng#4. get value of the inversemakeCacheMatrix <- function(x = matrix()) { j <- NULL set <- function(y) { x <<- y j <<- NULL } get <- function() x setinverse <- function(solve) j <<- solve getinverse <- function() j list(set = set, get = get, setinverse = setinverse, getinverse = getinverse) } ## `cacheSolve` function computes the inverse of the "matrix" returned by `makeCacheMatrix` above. #If the inverse has already been calculated (and the matrix has not changed), then`cacheSolve` should retrieve the inverse from the cache. ## when giving: Error in x$getinverse : $ operator is invalid for atomic vectors cachesolve <- function(x, ...) { i<- x$getinverse() if(!is.null(j)) { message("getting cached data") return(j) } data <- x$get() j<- solve(data, ...) x$setinverse(j) j } ## makeCacheMatrix function creates a "matrix" object that caches its inverse. #1. set value of the matrix rdpeng#2. get value of the matrix rdpeng#3. set value of the inverse rdpeng#4. get value of the inversemakeCacheMatrix <- function(x = matrix()) { j <- NULL set <- function(y) { x <<- y j <<- NULL } get <- function() x setinverse <- function(solve) j <<- solve getinverse <- function() j list(set = set, get = get, setinverse = setinverse, getinverse = getinverse) } ## `cacheSolve` function computes the inverse of the "matrix" returned by `makeCacheMatrix` above. #If the inverse has already been calculated (and the matrix has not changed), then`cacheSolve` should retrieve the inverse from the cache. ## when giving: Error in x$getinverse : $ operator is invalid for atomic vectors cachesolve <- function(x, ...) { i<- x$getinverse() if(!is.null(j)) { message("getting cached data") return(j) } data <- x$get() j<- solve(data, ...) x$setinverse(j) j }
mksarnala
referenced
this pull request
in mksarnala/ProgrammingAssignment2
May 15, 2017
cbirole
added a commit
to cbirole/ProgrammingAssignment2
that referenced
this pull request
Feb 27, 2018
makeCacheMatrix <- function(x = matrix()) {
inv <- NULL
set <- function(y) { rdpeng#2
x <<- y
inv <<- NULL
}
get <- function() x rdpeng#1
setinverse <- function(inverse) inv <<- inverse rdpeng#3
getinverse <- function() inv rdpeng#4
list(set=set, get=get, setinverse=setinverse,getinverse=getinverse)
}
#This function returns the inverse of matrix,
#it checks if the inverse has already been returned first. If so, it gets the result.
#if not, it retrieve the matrix from cache
cacheSolve <- function(x, ...) {
## Return a matrix that is the inverse of 'x'
inv <- x$getinverse{ ##Chitra's comment- Unexpected '{'
if(!is.null(inv)){
message('getting cached data')
return (inv)
} #Chitra's comment- If I run this code in R - I get an error stating object 'inv' not found
data <- x$get() #Chitra's comment- $ operator is unexpected here
inv <- solve(data) #Chitra's comment- R is not able to coerce type 'closure' to vector type 'any'
x$setinverse(inv) #Chitra's comment- $ is unexpected
inv #Chitra's comment- Object 'inv' not found
} #Chitra's comment- unexpected '}'
}
Closed
harshtripathi6
added a commit
to harshtripathi6/ProgrammingAssignment2
that referenced
this pull request
Apr 26, 2020
kenyasmiles
referenced
this pull request
in kenyasmiles/ProgrammingAssignment2
Oct 13, 2020
wguo2017
added a commit
to wguo2017/ProgrammingAssignment2
that referenced
this pull request
Aug 26, 2021
swsan
added a commit
to swsan/ProgrammingAssignment2
that referenced
this pull request
Nov 9, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.