{"id":14067354,"url":"https://github.com/data-cleaning/dcmodifydb","last_synced_at":"2025-10-22T03:42:20.482Z","repository":{"id":56934213,"uuid":"363682496","full_name":"data-cleaning/dcmodifydb","owner":"data-cleaning","description":"Deterministic, documented correction rules on a database","archived":false,"fork":false,"pushed_at":"2022-12-07T16:37:20.000Z","size":599,"stargazers_count":5,"open_issues_count":7,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-04T07:37:23.127Z","etag":null,"topics":["correction","data-cleaning","database","r"],"latest_commit_sha":null,"homepage":"https://data-cleaning.github.io/dcmodifydb","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/data-cleaning.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}},"created_at":"2021-05-02T15:22:27.000Z","updated_at":"2024-05-06T04:38:46.000Z","dependencies_parsed_at":"2022-08-21T00:40:30.071Z","dependency_job_id":null,"html_url":"https://github.com/data-cleaning/dcmodifydb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/data-cleaning/dcmodifydb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/data-cleaning%2Fdcmodifydb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/data-cleaning%2Fdcmodifydb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/data-cleaning%2Fdcmodifydb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/data-cleaning%2Fdcmodifydb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/data-cleaning","download_url":"https://codeload.github.com/data-cleaning/dcmodifydb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/data-cleaning%2Fdcmodifydb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267785809,"owners_count":24144122,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["correction","data-cleaning","database","r"],"created_at":"2024-08-13T07:05:33.237Z","updated_at":"2025-10-22T03:42:15.435Z","avatar_url":"https://github.com/data-cleaning.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# dcmodifydb\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/dcmodifydb)](https://CRAN.R-project.org/package=dcmodifydb)\n[![R-CMD-check](https://github.com/data-cleaning/dcmodifydb/workflows/R-CMD-check/badge.svg)](https://github.com/data-cleaning/dcmodifydb/actions)\n[![Downloads](https://cranlogs.r-pkg.org/badges/dcmodifydb)](https://cran.r-project.org/package=dcmodifydb)\n[![Codecov test coverage](https://codecov.io/gh/data-cleaning/dcmodifydb/branch/main/graph/badge.svg)](https://codecov.io/gh/data-cleaning/dcmodifydb?branch=main)\n\u003c!-- badges: end --\u003e\n\nThe goal of dcmodifydb is to apply modification rules specified with `dcmodify` \non a database table, allowing for documented, reproducable data cleaning adjustments\nin a database.\n\n`dcmodify` separates **intent** from **execution**: a user specifies _what_, _why_ and _how_ of an automatic data change and uses `dcmodifydb` to  execute them on a `tbl` database table.\n\n## Installation\n\n\u003c!-- You can install the released version of dcmodifydb from [CRAN](https://CRAN.R-project.org) with: --\u003e\n\n\u003c!-- ``` r --\u003e\n\u003c!-- install.packages(\"dcmodifydb\") --\u003e\n\u003c!-- ``` --\u003e\n\nThe development version from [GitHub](https://github.com/) can be installed with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"data-cleaning/dcmodifydb\")\n```\n## Example\n\n\n```{r, code = readLines(\"./example/modify.R\")}\n```\n\n\n### Documented rules\n\n\n```{r}\nlibrary(DBI)\nlibrary(dcmodify)\nlibrary(dcmodifydb)\ncon \u003c- dbConnect(RSQLite::SQLite())\n```\n\n\nYou can use YAML to store the modification rules: \"example.yml\"\n\n```yaml\n```{r, result=\"asis\", child=\"example/example.yml\"}\n```\n```\n\nLet's load the rules and apply them to a data set:\n\n```{r, eval = FALSE}\nm \u003c- modifier(.file = \"example.yml\")\n```\n\n```{r, echo = FALSE, eval = TRUE}\nm \u003c- modifier(.file = \"example/example.yml\")\n```\n\n```{r}\nprint(m)\n```\n\n\n```{r}\n# setup the data\n\"age, income\n  11,   2000\n 150,    300\n  25,   2000\n -10,   2000\n\" -\u003e csv\nincome \u003c- read.csv(text = csv, strip.white = TRUE)\ndbWriteTable(con, \"income\", income)\ntbl_income \u003c- dplyr::tbl(con, \"income\")\n\n# this is the table in the data base\ntbl_income\n\n# and now after modification\nmodify(tbl_income, m, copy = FALSE) \n```\n\nGenerated sql can be written with `dump_sql`\n\n```{r, eval=FALSE}\ndump_sql(m, tbl_income, file = \"modify.sql\")\n```\n\nmodify.sql:\n```sql\n```{r, echo=FALSE, results='asis'}\ndump_sql(m, tbl_income)\n```\n```\n\n\n```{r}\ndbDisconnect(con)\n```\n\nNote: Modification rules can be written to yaml with `as_yaml` and `export_yaml`.\n\n```{r, eval = FALSE}\ndcmodify::export_yaml(m, \"cleaning_steps.yml\")\n```\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdata-cleaning%2Fdcmodifydb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdata-cleaning%2Fdcmodifydb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdata-cleaning%2Fdcmodifydb/lists"}