Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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'))
```