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

https://github.com/ThinkR-open/thinkr

Some tools for cleaning up messy 'Excel' files to be suitable for R
https://github.com/ThinkR-open/thinkr

cran hacktoberfest r-package thinkr-not-maintained

Last synced: 4 months ago
JSON representation

Some tools for cleaning up messy 'Excel' files to be suitable for R

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(thinkr)
library(dplyr)
```

[![R-CMD-check](https://github.com/ThinkR-open/thinkr/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/thinkr/actions)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/thinkr)](https://cran.r-project.org/package=thinkr)
[![](http://cranlogs.r-pkg.org/badges/thinkr)](https://cran.r-project.org/package=thinkr)
[![Coverage status](https://codecov.io/gh/ThinkR-open/thinkr/branch/master/graph/badge.svg)](https://codecov.io/github/ThinkR-open/thinkr?branch=master)

```{r, echo=FALSE, out.width="250px"}
knitr::include_graphics("https://raw.githubusercontent.com/ThinkR-open/thinkr/master/inst/img/thinkr-hex-thinkr-package.png")
```

# thinkr

{thinkr} is a set of tools for Cleaning Up Messy Files.

It contains some tools for cleaning up messy 'Excel' files to be suitable for R. People who have been working with 'Excel' for years built more or less complicated sheets with names, characters, formats that are not homogeneous. To be able to use them in R nowadays, we built a set of functions that will avoid the majority of importation problems and keep all the data at best.

## Installation

CRAN version
```{r, eval=FALSE}
install.packages("thinkr")
```

Github development version
```{r, eval=FALSE}
# install.packages("devtools")
devtools::install_github("ThinkR-open/thinkr")
```

Once installed, you can load `{thinkr}`:

```{r}
library(thinkr)
```

or without the package startup message:

```{r}
suppressPackageStartupMessages(library(thinkr))
```

## Usage

### `peep`
`peep` function allows to print intermediate outputs inside a {dplyr}/`%>%` workflow

```{r}
data(iris)
# just symbols
iris %>%
peep(head, tail) %>%
rename(species = Species) %>%
summary()
# expressions with .
iris %>%
peep(head(., n = 2), tail(., n = 3)) %>%
summary()
# or both
iris %>%
peep(head, tail(., n = 3)) %>%
summary()
# use verbose to see what happens
iris %>%
peep(head, tail(., n = 3), verbose = TRUE) %>%
summary()
```

### `clean_*`

Function `clean_names` allows to clean dirty names, while removing special characters, spaces, ...

```{r}
data(iris)

iris %>% head()
iris %>%
clean_names() %>%
head()
```

Function `clean_vec` allows to clean character vectors, while removing special characters, spaces, ...

```{r}
vector <- c("Jean Sébastien", "Anne-Sophie", "44@Bernard2")
cleaned <- clean_vec(vector)
cleaned
```

### Excel positions

Find Excel column position name from column number and inversely

```{r}
ncol_to_excel(6)
excel_to_ncol("AF")
```

## Code of Conduct

Please note that this project is released with a [Contributor Code of Conduct](https://www.contributor-covenant.org/version/1/0/0/code-of-conduct.html). By participating in this project you agree to abide by its terms.