{"id":14066454,"url":"https://github.com/moodymudskipper/replace","last_synced_at":"2025-04-12T20:52:22.846Z","repository":{"id":171330110,"uuid":"639462649","full_name":"moodymudskipper/replace","owner":"moodymudskipper","description":"Replace Variable Names in R Scripts","archived":false,"fork":false,"pushed_at":"2024-05-30T09:44:50.000Z","size":8,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T20:52:18.482Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moodymudskipper.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-11T13:54:55.000Z","updated_at":"2024-05-30T09:44:53.000Z","dependencies_parsed_at":"2024-02-19T18:24:45.302Z","dependency_job_id":"2de278ce-8295-4bae-b15d-5b9fe534c8f7","html_url":"https://github.com/moodymudskipper/replace","commit_stats":null,"previous_names":["moodymudskipper/replace"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moodymudskipper%2Freplace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moodymudskipper%2Freplace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moodymudskipper%2Freplace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moodymudskipper%2Freplace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moodymudskipper","download_url":"https://codeload.github.com/moodymudskipper/replace/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631728,"owners_count":21136560,"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":"2024-08-13T07:05:06.478Z","updated_at":"2025-04-12T20:52:22.822Z","avatar_url":"https://github.com/moodymudskipper.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# replace\n\nChoose a target, a replacement, files or folders, and whether you want to replace standard variables, function calls, argument names, formal names, or package names.\n\n## Installation\n\nYou can install the development version of replace like so:\n\n``` r\nremotes::install_github(\"moodymudskipper/replace\")\n```\n\n## Example\n\n```{r example}\nlibrary(replace)\ntmp \u003c- tempfile(fileext = \".R\")\ncode \u003c- \"\n# foo\nfoo \u003c- function(foo = foo) {\n   foo(this)\n   foo('foo')\n   foo::foo(foo = foo$foo)\n   lapply(foo, foo)\n}\n\"\nwriteLines(code, tmp)\n\n# by default we look at everything udner the R folder and replace variables and function calls\n# below we do it every token type in succession\n\n#tmp\nreplace_in_files(\"foo\", \"VAR\", tmp, \"var\") # variable names and `$` elements\nreplace_in_files(\"foo\", \"FUN\", tmp, \"fun\")\nreplace_in_files(\"foo\", \"ARG\", tmp, \"arg\")\nreplace_in_files(\"foo\", \"FORMAL\", tmp, \"formal\")\nreplace_in_files(\"foo\", \"PACKAGE\", tmp, \"package\")\nreplace_in_files(\"# foo\", \"# COMMENT\", tmp, \"comment\")\nreplace_in_files(\"'foo'\", \"'STRING'\", tmp, \"string\")\nreplace_in_files(\"FUN(this)\", \"EXPRESSION\", tmp, \"expression\")\ncat(readLines(tmp), sep = \"\\n\")\n```\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoodymudskipper%2Freplace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoodymudskipper%2Freplace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoodymudskipper%2Freplace/lists"}