Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christopherkenny/name
Tools for Working with Names
https://github.com/christopherkenny/name
Last synced: 28 days ago
JSON representation
Tools for Working with Names
- Host: GitHub
- URL: https://github.com/christopherkenny/name
- Owner: christopherkenny
- License: other
- Created: 2021-09-18T19:09:13.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-06T18:42:13.000Z (over 2 years ago)
- Last Synced: 2023-11-20T15:47:24.043Z (12 months ago)
- Language: R
- Homepage: http://www.christophertkenny.com/name/
- Size: 4.73 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# name
[![R-CMD-check](https://github.com/christopherkenny/name/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/christopherkenny/name/actions/workflows/R-CMD-check.yaml)
Organizes functions for consistent column naming for `tibble`s and `data.frame`s.
## Installation
You can install the current version of `name` from GitHub.
``` r
devtools::install_github('name')
```## Example
```{r}
library(name)
library(dplyr)
data(mtcars)
```We can add a prefix:
```{r}
mtcars <- mtcars %>%
rename_with(\(x) add_pref(x, 'pref_'))
```And similarly a suffix:
```{r}
mtcars <- mtcars %>%
rename_with(\(x) add_suff(x, '_suff'))
```Or a replace a phrase:
```{r}
mtcars <- mtcars %>%
rename_with(\(x) repl_phrase(x, '_hp', '_hitpoints'))
```