{"id":28214143,"url":"https://github.com/vzool/datasciencecoursera","last_synced_at":"2025-06-11T20:30:46.851Z","repository":{"id":15905562,"uuid":"18647125","full_name":"vzool/datasciencecoursera","owner":"vzool","description":"Data Science Coursera","archived":false,"fork":false,"pushed_at":"2014-04-27T12:52:12.000Z","size":47084,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T20:12:17.831Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vzool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-10T18:28:38.000Z","updated_at":"2014-04-27T12:52:12.000Z","dependencies_parsed_at":"2022-09-24T05:31:01.011Z","dependency_job_id":null,"html_url":"https://github.com/vzool/datasciencecoursera","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vzool/datasciencecoursera","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fdatasciencecoursera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fdatasciencecoursera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fdatasciencecoursera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fdatasciencecoursera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vzool","download_url":"https://codeload.github.com/vzool/datasciencecoursera/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzool%2Fdatasciencecoursera/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259334608,"owners_count":22842466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-17T20:12:17.699Z","updated_at":"2025-06-11T20:30:46.846Z","avatar_url":"https://github.com/vzool.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n## This is a markdown file\n=======\n### Introduction\n\nThis second programming assignment will require you to write an R\nfunction that is able to cache potentially time-consuming computations.\nFor example, taking the mean of a numeric vector is typically a fast\noperation. However, for a very long vector, it may take too long to\ncompute the mean, especially if it has to be computed repeatedly (e.g.\nin a loop). If the contents of a vector are not changing, it may make\nsense to cache the value of the mean so that when we need it again, it\ncan be looked up in the cache rather than recomputed. In this\nProgramming Assignment you will take advantage of the scoping rules of\nthe R language and how they can be manipulated to preserve state inside\nof an R object.\n\n### Example: Caching the Mean of a Vector\n\nIn this example we introduce the `\u003c\u003c-` operator which can be used to\nassign a value to an object in an environment that is different from the\ncurrent environment. Below are two functions that are used to create a\nspecial object that stores a numeric vector and caches its mean.\n\nThe first function, `makeVector` creates a special \"vector\", which is\nreally a list containing a function to\n\n1.  set the value of the vector\n2.  get the value of the vector\n3.  set the value of the mean\n4.  get the value of the mean\n\n\u003c!-- --\u003e\n\n    makeVector \u003c- function(x = numeric()) {\n            m \u003c- NULL\n            set \u003c- function(y) {\n                    x \u003c\u003c- y\n                    m \u003c\u003c- NULL\n            }\n            get \u003c- function() x\n            setmean \u003c- function(mean) m \u003c\u003c- mean\n            getmean \u003c- function() m\n            list(set = set, get = get,\n                 setmean = setmean,\n                 getmean = getmean)\n    }\n\nThe following function calculates the mean of the special \"vector\"\ncreated with the above function. However, it first checks to see if the\nmean has already been calculated. If so, it `get`s the mean from the\ncache and skips the computation. Otherwise, it calculates the mean of\nthe data and sets the value of the mean in the cache via the `setmean`\nfunction.\n\n    cachemean \u003c- function(x, ...) {\n            m \u003c- x$getmean()\n            if(!is.null(m)) {\n                    message(\"getting cached data\")\n                    return(m)\n            }\n            data \u003c- x$get()\n            m \u003c- mean(data, ...)\n            x$setmean(m)\n            m\n    }\n\n### Assignment: Caching the Inverse of a Matrix\n\nMatrix inversion is usually a costly computation and there may be some\nbenefit to caching the inverse of a matrix rather than computing it\nrepeatedly (there are also alternatives to matrix inversion that we will\nnot discuss here). Your assignment is to write a pair of functions that\ncache the inverse of a matrix.\n\nWrite the following functions:\n\n1.  `makeCacheMatrix`: This function creates a special \"matrix\" object\n    that can cache its inverse.\n2.  `cacheSolve`: This function computes the inverse of the special\n    \"matrix\" returned by `makeCacheMatrix` above. If the inverse has\n    already been calculated (and the matrix has not changed), then\n    `cacheSolve` should retrieve the inverse from the cache.\n\nComputing the inverse of a square matrix can be done with the `solve`\nfunction in R. For example, if `X` is a square invertible matrix, then\n`solve(X)` returns its inverse.\n\nFor this assignment, assume that the matrix supplied is always\ninvertible.\n\nIn order to complete this assignment, you must do the following:\n\n1.  Fork the GitHub repository containing the stub R files at\n    [https://github.com/rdpeng/ProgrammingAssignment2](https://github.com/rdpeng/ProgrammingAssignment2)\n    to create a copy under your own account.\n2.  Clone your forked GitHub repository to your computer so that you can\n    edit the files locally on your own machine.\n3.  Edit the R file contained in the git repository and place your\n    solution in that file (please do not rename the file).\n4.  Commit your completed R file into YOUR git repository and push your\n    git branch to the GitHub repository under your account.\n5.  Submit to Coursera the URL to your GitHub repository that contains\n    the completed R code for the assignment.\n\n### Grading\n\nThis assignment will be graded via peer assessment.\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e 7f657dd22ac20d22698c53b23f0057e1a12c09b7\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvzool%2Fdatasciencecoursera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvzool%2Fdatasciencecoursera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvzool%2Fdatasciencecoursera/lists"}