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

R-CMD-check CRAN_Status_Badge Coverage status

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

install.packages("thinkr")

Github development version

# install.packages("devtools")
devtools::install_github("ThinkR-open/thinkr")

Once installed, you can load {thinkr}:

library(thinkr)

or without the package startup message:

suppressPackageStartupMessages(library(thinkr))

Usage

peep

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

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, ...

data(iris)

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

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

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

ncol_to_excel(6)
excel_to_ncol("AF")

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



ThinkR-open/thinkr documentation built on Aug. 25, 2022, 2:45 p.m.