-
Notifications
You must be signed in to change notification settings - Fork 144k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed some minor typos. #1
Conversation
Mr Peng, Should I open the pull request as I felt it might let others see the code. Sent via BlackBerry by AT&T -----Original Message----- Merged #1. Reply to this email directly or view it on GitHub: |
effort rdpeng#1
Fixed some minor typos. git-svn-id: https://github.com/duggulous/ProgrammingAssignment2.git/trunk@6 685be34d-3623-72cb-7069-ce57b7db7bff
Delete HelloWorld.md
Merge pull request rdpeng#1 from BedgieBear/master
Submitting draft rdpeng#1 of assignment 2: Contains fully functioning makeChacheMatrix with set, get, setinv, and get inv. Also contains cacheSolve which retrieves the invese of a matrix from cache.
2014.07.27 rdpeng#1 Committing "Programming Assignment 2: Lexical Scoping" R file into my git repository
A pair of functions that cache the inverse of a matrix: makeCacheMatrix cacheSolve Added more comments to bring clarity to the program Should be run in the command line/terminal this way: rdpeng#1. pass a square matrix to makeCacheMatrix (example: A=matrix(c(1,2,3,4), nrow=2, ncol=2) rdpeng#2 cache the inverse with cacheSolve(A) rdpeng#3 access the cached inverse with cacheSolve(A)
Submission rdpeng#1
commit rdpeng#1 for R Programming Assignment 2
1st working solution
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 '}' }
Update cachematrix.R
These typos do not cause any difficulties in understanding the instructions, so fixing them would be purely for aesthetical reasons.