-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
77 lines (45 loc) · 4.09 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
output:
github_document:
highlight: pygments
---
```{r, include = FALSE}
knitr::opts_chunk$set(
fig.path = "man/figures/"
)
```
[![R build status](https://github.com/m-clark/tidyext/workflows/R-CMD-check/badge.svg)](https://github.com/m-clark/tidyext/actions)
[![codecov](https://codecov.io/gh/m-clark/tidyext/branch/master/graph/badge.svg)](https://codecov.io/gh/m-clark/tidyext)
<a href="https://github.com/m-clark/tidyext" alt="Miscellaneous Shenanigans">
<img src="https://img.shields.io/badge/miscellaneous_shenanigans-constant-ff5500.svg?colorA=00aaff&longCache=true&style=for-the-badge" style="width:50%"/></a>
<br>
# tidyext <img src="man/figures/tidyext_hex.png" align = "right" width = 100>
### Overview
Extensions and extras for tidy processing. This package provides some data processing and summarizing functions that would commonly be useful in the tidyverse. For folks that do a lot of data processing in that world, these make a handful of some very common tasks a bit easier, and with an eye toward eventual tidy/clean presentation and visualization with tools like [kableExtra](https://haozhu233.github.io/kableExtra/awesome_table_in_html.html) and [ggplot2](http://ggplot2.tidyverse.org/).
As these functions are more universally useful, especially to my colleagues and friends who use R, putting them as their own package with few dependencies will perhaps make it easier to use for them. The goal is more or less for this to depend on nothing one wouldn't have already with base R and the tidyverse package loaded. Also, as all the functions use the tidyverse functionality, they are easily customizable.
### Installation
To install from GitHub the <span class="pack">devtools</span> package is required.
```{r eval=FALSE}
devtools::install_github('m-clark/tidyext')
```
Note that this package more or less assumes your are working within the <span class="pack">tidyverse</span>, especially <span class="pack">dplyr</span>. As such you should have the <span class="pack">tidyverse</span> packages installed.
### Functions
- <span class="func">cat_by</span>: A quick summarize for categorical variables, possibly with `dplyr::group_by`, that provides frequencies and percentages of categories, ready for publishing tables or plotting.
- <span class="func">combn_2_col</span>: Takes a column with multiple entries per cell and creates indicator columns of all possible combinations of the cell values up to m combinations.
- <span class="func">create_prediction_data</span>: Straightforward way to quickly create data to make model predictions.
- <span class="func">describe_all</span>: A summary function for mixed data types that provides the information I usually want. Saves one from doing a `group_by %>% summarize` operation to create multiple results for multiple types of variables. Has corresponding <span class="func">describe_all_num</span> and <span class="func">describe_all_cat</span> for numeric-only and categorical-only data respectively.
- <span class="func">num_by</span>: A quick summarize, possibly with `dplyr::group_by`, that provides things like mean, sd, etc. See <span class="func">num_summary</span>.
- <span class="func">num_summary</span>: A little better than the base R summary, gives the info one typically wants as well as options for rounding and other statistics.
- <span class="func">onehot</span>: A function for one-hot encoding with a few helpful options for dealing with missing data, using sparse matrices, and more.
- <span class="func">pre_process</span>: Easily pre-process a data set with common operations like standardization, logging, etc.
- <span class="func">sum_NA</span>, <span class="func">sum_NaN</span>, <span class="func">sum_blank</span>: Understand your nothingness.
- <span class="func">row_sums</span>, <span class="func">row_means</span>, <span class="func">row_apply</span>: Simple (intuitive) rowwise calculations.
<br>
### Version history
- 0.3.0 add `row_sums`, `row_means`, `row_apply`
- 0.2.x Misc updates
- 0.2.0 Website
- 0.1.3 Added `gather_multi`
- 0.1.2 Added `spread2`
- 0.1.1 Added `pre_process`
- 0.1.0 Initial release