<file_sep>## This set of functions takes in a matrix and creates the inverse of it. If that calculation has
##   already been done before, it knows to get the answer from the cache instead of recalculating

# this function gets a matrix and returns the inverse of the matrix
makeCacheMatrix <- function(x = matrix()) {
  # m stores the cached inverse matrix
  m <- NULL
  # sets the matrix
  set <- function (y) {
    x <<- y
    m <<- NULL
  }
  # gets the matrix
  get <- function() x
  # sets the inverse
  setinverse <- function(solve) m <<- solve
  # gets the inverse
  getinverse <- function() m
  # returns the matrix
  list(set = set, get = get, setinverse = setinverse, getinverse = getinverse)
}

# this function checks to see of the matrix is cached, before it (re)calculates
cacheSolve <- function(x, ...) {
        ## Return a matrix that is the inverse of 'x'
    m<-x$getinverse()
    #if the inverse is calculated, return it
    if(!is.null(m)){
      message("getting chached data")
      return(m)
    }
    # The inverse isn't calculated yet, so do the calculation
    data<-x$get()
    m<-solve(data)
    # cache inverse
    x$setinverse(m)
    # return inverse
    m
}
