{"id":24629514,"url":"https://github.com/stufield/wranglr","last_synced_at":"2025-03-20T04:35:50.337Z","repository":{"id":267500357,"uuid":"865007418","full_name":"stufield/wranglr","owner":"stufield","description":"The wranglr package contains general functions necessary to manipulate and wrangle internal R representations of proteomic data into convenient forms for analysis.","archived":false,"fork":false,"pushed_at":"2025-03-18T16:27:04.000Z","size":4809,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T17:36:52.699Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://stufield.github.io/wranglr/","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/stufield.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-29T18:37:06.000Z","updated_at":"2025-03-18T16:27:09.000Z","dependencies_parsed_at":"2024-12-10T18:41:04.261Z","dependency_job_id":"92062d12-780f-4ad2-8f69-c1924d58bb6b","html_url":"https://github.com/stufield/wranglr","commit_stats":null,"previous_names":["stufield/wranglr"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stufield%2Fwranglr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stufield%2Fwranglr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stufield%2Fwranglr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stufield%2Fwranglr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stufield","download_url":"https://codeload.github.com/stufield/wranglr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554042,"owners_count":20471172,"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-01-25T06:13:10.436Z","updated_at":"2025-03-20T04:35:50.311Z","avatar_url":"https://github.com/stufield.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\noptions(width = 100)\nSys.setlocale(\"LC_COLLATE\", \"en_US.UTF-8\") # ensure common sorting envir\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nver \u003c- desc::desc_get_version(\".\")\nver \u003c- paste0(\"https://img.shields.io/badge/Version-\", ver,\n              \"-success.svg?style=flat\u0026logo=github\")\nsample_df \u003c- wranglr:::sample_df\n```\n\n\n# The `wranglr` package\n\n\u003c!-- badges: start --\u003e\n![GitHub version](`r ver`)\n[![CRAN status](http://www.r-pkg.org/badges/version/wranglr)](https://cran.r-project.org/package=wranglr)\n[![R-CMD-check](https://github.com/stufield/wranglr/workflows/R-CMD-check/badge.svg)](https://github.com/stufield/wranglr/actions)\n[![](https://cranlogs.r-pkg.org/badges/grand-total/wranglr)](https://cran.r-project.org/package=wranglr)\n[![Codecov test coverage](https://codecov.io/gh/stufield/wranglr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/stufield/wranglr?branch=main)\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://choosealicense.com/licenses/mit/)\n\u003c!-- badges: end --\u003e\n\n\n## Overview\n\nThe `wranglr` package contains general functions\nnecessary to manipulate and wrangle internal `R` representations\nof proteomic data into convenient forms for analysis.\n\n\n----------------\n\n\n## Installation\n\n```{r install-git, eval = FALSE}\n# current dev version\nremotes::install_github(\"stufield/wranglr\")\n\n# or a specific version\nremotes::install_github(\"stufield/wranglr@v0.0.1\")\n```\n\n\n----------------\n\n\n## Usage\n\nTo load `wranglr` simply make a call to `library()` as usual:\n\n```{r load, message = FALSE}\nlibrary(wranglr)\n```\n\n\n## Help summary of the package\n\n```{r help, eval = FALSE}\nlibrary(help = wranglr)\n```\n\n\n-------------\n\n\n## Useful functions in `wranglr`\n\n\n### Transforming Data\n\n* `center_scale()`\n* `create_recipe()`\n\n```{r center-scale}\nscaled \u003c- center_scale(mtcars)\napply(feature_matrix(scaled), 2, mean) |\u003e sum()  # mean = 0\napply(feature_matrix(scaled), 2, sd)             # sd = 1\n\n# `create_recipe()`\nrcp \u003c- create_recipe(mtcars)\nrcp\n```\n\n-----------\n\n\n```{r helpr, echo = FALSE}\nlibrary(helpr)   # needs get_outliers()\n```\n\n### Imputing Data\n\n* `impute_outliers()`, `get_outliers()` (`helpr`)\n* `imputeNAs()`\n* `impute_predictors()`\n\n```{r imputing}\n# Outliers\nx \u003c- withr::with_seed(1, rnorm(10))   # normal\nx \u003c- c(x, 100)                        # add outlier\nget_outliers(x)                       # index of the outlier\n\n# parameters stored in attributes (parametric only)\nattributes(get_outliers(x, type = \"para\"))\n\n# Impute 11th value\nimpute_outliers(x)\n\n# Impute NAs\nx \u003c- withr::with_seed(1, rnorm(6))\nx[ c(3, 5) ] \u003c- NA\nmedian(x, na.rm = TRUE)\n\nimputeNAs(x)\n\ntable(imputeNAs(x))\n\n# Predictors\nx   \u003c- data.frame(a = 1:3, b = 4:6, c = 7:9, d = c(1.23, 4.56, 7.89))\ntbl \u003c- tibble::tribble(\n  ~ Feature,  ~ xtrm_max, ~ impute_max, ~ xtrm_min, ~ impute_min,\n    \"a\",         NA,        NA,           NA,         NA,\n    \"b\",         5,         5,            0,          1,\n    \"c\",         9,         7,            7.1,        7.1\n)\nimpute_predictors(x, tbl)\n```\n\n-----------\n\n\n### Binding Data\n\n* `bind_intersect()`\n* `bind_union()`\n\n```{r bind}\ndf1 \u003c- data.frame(a = 1, b = 2, c = 3, row.names = \"A\")\ndf2 \u003c- data.frame(a = 4, b = 5, d = 6, row.names = \"B\")\ndf3 \u003c- data.frame(a = 7, b = 8, e = 9, row.names = \"C\")\nlist_df  \u003c- list(a = df1, b = df2, c = df3)\nlist_df\n\nbind_intersect(list_df)\n\nbind_union(list_df)\n```\n\n-----------\n\n### Selecting Feature Data\n\n* `refactor_data()`\n* `feature_matrix()`\n\n```{r refactor}\ndf  \u003c- data.frame(a = factor(c(\"a\", \"b\")), b = 1:2L)\nfoo \u003c- df[df$a == \"a\", ]\nfoo\n\nlevels(foo$a)   # 2 levels! \"b\" is a ghost level\n\nbar \u003c- refactor_data(foo)\nlevels(bar$a)   # 1 level now\n```\n\n-----------\n\n### Sequence IDs and Annotations\n\n* `lookup_anno()`\n* `seq_lookup()`\n* `seqify()`\n\n```{r seq-lookup}\nseqs \u003c- withr::with_seed(101, sample(names(sample_df), 10L))\nseqs\n\n# NAs for those analytes dropped from menu\nseq_lookup(seqs)\n\nseqify(seqs)\n\n# Pass `tbl` containing annotations\n# to reconstitute those missing ones\nanno \u003c- attr(sample_df, \"anno\")\nseq_lookup(seqs, tbl = anno)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstufield%2Fwranglr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstufield%2Fwranglr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstufield%2Fwranglr/lists"}