{"id":15893002,"url":"https://github.com/shprintsin/defactor","last_synced_at":"2025-04-02T17:40:33.176Z","repository":{"id":257098346,"uuid":"857320622","full_name":"shprintsin/defactor","owner":"shprintsin","description":"R package for dynamically managing, annotating, and retrieving variable labels in data frames. It provides functions to efficiently set and extract labels based on patterns, column selections, or custom rules, enhancing data cleaning and analysis workflows.","archived":false,"fork":false,"pushed_at":"2024-12-09T00:46:48.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T08:14:37.776Z","etag":null,"topics":["data-annotation","data-cleaning","data-labeling","data-manipulation","r","r-package"],"latest_commit_sha":null,"homepage":"","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/shprintsin.png","metadata":{"files":{"readme":"README.md","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":"2024-09-14T10:43:42.000Z","updated_at":"2024-12-09T00:46:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"7644636f-4b92-4ff6-8f3c-a84721e53f73","html_url":"https://github.com/shprintsin/defactor","commit_stats":null,"previous_names":["shprintsin/defactor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shprintsin%2Fdefactor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shprintsin%2Fdefactor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shprintsin%2Fdefactor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shprintsin%2Fdefactor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shprintsin","download_url":"https://codeload.github.com/shprintsin/defactor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246863553,"owners_count":20846271,"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":["data-annotation","data-cleaning","data-labeling","data-manipulation","r","r-package"],"created_at":"2024-10-06T08:06:04.044Z","updated_at":"2025-04-02T17:40:33.153Z","avatar_url":"https://github.com/shprintsin.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# defactor R package\n\n**defactor** is an R package that provides a set of tools for managing, annotating, and retrieving variable labels in data frames. The package allows for dynamic setting and extraction of labels based on patterns, column selections, or custom specifications, making it particularly useful for data cleaning, analysis, and preparation tasks where labeled data is critical for interpretation and reporting.\n\n## Key Features\n\n- **Dynamic Label Management**: Easily retrieve, set, and manage variable labels in your data frames.\n- **Pattern-Based Labeling**: Set labels for columns matching specific regex patterns.\n- **Custom Column Selection**: Set labels for a user-defined list of column names.\n- **Data Frame Summarization**: Retrieve detailed summaries of variable names, labels, and their corresponding category values.\n\n## Installation\n\nTo install the **defactor** package from GitHub, use the following command:\n\n```r\n# Install the devtools package if you haven't already\ninstall.packages(\"devtools\")\n\n# Install defactor from GitHub\ndevtools::install_github(\"shprintsin/defactor\")\n```\n\n## Usage\n\nLoad the package and use its functions to manage labels in your data frames:\n\n```r\n# Load the package\nlibrary(defactor)\n\nexample\n# Load the required package\nlibrary(data.table)\n\n# Create the data table\ndt \u003c- data.table(\n  C_COW_ALPHA = c(\"BOS\", \"BOS\", \"BOS\", \"BOS\", \"BOS\"),\n  COW = c(346, 346, 346, 346, 346),\n  B_COUNTRY_ALPHA = c(\"BIH\", \"BIH\", \"BIH\", \"BIH\", \"BIH\"),\n  V2 = c(70, 70, 70, 70, 70),\n  V2A = c(70, 70, 70, 70, 70),\n  V3 = c(1, 2, 3, 4, 5),\n  V4 = c(1, 1, 1, 1, 1),\n  V5 = c(1, 1, 1, 1, 1),\n  V6 = c(1, 2, 2, 1, 2)\n)\n\n# Add column labels as attributes\nattr(dt$COW, \"label\") \u003c- \"colum1\"\nattr(dt$V2, \"label\") \u003c- \"colum2\"\nattr(dt$V2A, \"label\") \u003c- \"colum3\"\nattr(dt$V4, \"label\") \u003c- \"colum4\"\nattr(dt$V5, \"label\") \u003c- \"colum5\"\nattr(dt$V6, \"label\") \u003c- \"colum6\"\n\n# Add value labels as attributes\nattr(dt$COW, \"labels\") \u003c- c(\"Bosnia and Herzegovina\" = 346)\nattr(dt$V2, \"labels\") \u003c- c(\"Bosnia Herzegovina\" = 70)\nattr(dt$V2A, \"labels\") \u003c- c(\"Bosnia Herzegovina\" = 70)\nattr(dt$V4, \"labels\") \u003c- c(\"Very important\" = 1)\nattr(dt$V5, \"labels\") \u003c- c(\"Very important\" = 1)\nattr(dt$V6, \"labels\") \u003c- c(\"Very important\" = 1, \"Rather important\" = 2)\n\n\n\ngetLabel(df, \"V3\", limit = 3)\nsetLabel(df, \"V2\", suffix = \"_label\")\ncolInfo(df, limit = 2)\nlistVars(df)\n#setLblPat(df, pattern = \"V*\")\nsetlstLbl(df, columns = c('V5','V6'))\nsetLblPat(df, pattern = \"V\")\n\nstructure(df)\n\n\n```\n\n## Functions\n\n- `getLbl()`: Retrieves the labels of a specified column in a data frame.\n- `setLbl()`: Merges labels into the original data frame for a specified column.\n- `colInfo()`: Retrieves labels and details for all columns in the data frame.\n- `listVars()`: Lists all variable names and their labels from the data frame.\n- `setLblPat()`: Sets labels for all columns in a data frame that match a specified regex pattern.\n- `setlstLbl()`: Sets labels for all columns in a data frame that match a specified list of column names.\n\n## Contributing\n\nContributions are welcome! If you have suggestions for improvements or new features, please feel free to create an issue or submit a pull request.\n\n## License\n\nThis package is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Contact\n\nMaintainer: Shneior Shprintsin  \nEmail: shnyor360@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshprintsin%2Fdefactor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshprintsin%2Fdefactor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshprintsin%2Fdefactor/lists"}