From 790a2eaae2512f7b17c21ae670bf2db2f74744b0 Mon Sep 17 00:00:00 2001 From: Revathi0612 Date: Mon, 7 Apr 2025 11:29:51 +0530 Subject: [PATCH] R Programming --- R Programming | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 R Programming diff --git a/R Programming b/R Programming new file mode 100644 index 00000000000..55476b60f62 --- /dev/null +++ b/R Programming @@ -0,0 +1,19 @@ +makeCacheMatrix <- function() { +mat <- NULL +inv_cache <- NULL +setMatrix <-function(x){ +mat <<-x +inv_cache<<- NULL +} +getInverse <- function() { +if (is.null(inv_cache)){ +inv_cache <<-solve(mat) +} +inv_cache +} +list(setMatrix=setMatrix,getInverse = getInverse) +} +cacheSolve <- function(x,...){ +inv_cache <-x$getInverse() +inv_cache +}