-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
107 lines (85 loc) · 2.78 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
warning = FALSE,
message = TRUE,
error = FALSE,
comment = "#>",
fig.path = "man/figures/README-"
)
if (!interactive()) {
# options(width = 99)
}
```
# k5 <img src='man/figures/logo.png' align="right" height="139" />
<!-- badges: start -->
[![Lifecycle: experimental][life_badge]][life_link]
[![CRAN status][cran_badge]][cran_link]
![Downloads][dl_badge]
[![Codecov test coverage][cov_badge]][cov_link]
[![R build status][ga_badge]][ga_link]
<!-- badges: end -->
The goal of 'k5' is to offer miscellaneous quality of life functions used by
[Kiernan Nicholls][kn] during interactive programming. They make things easier
for me but are _bad_ for scripts and packages.
## Installation
You can install the release version of this package from [CRAN][cran_link]:
```{r install_cran, eval=FALSE}
install.packages("k5")
```
The development version can be installed from [GitHub][gh]:
```{r install_github, eval=FALSE}
# install.packages("remotes")
remotes::install_github("k5cents/k5")
```
## Example
```{r lib}
library(k5)
packageVersion("k5")
```
A list of frequently used packages can be loaded from a file.
```{r load}
load_my_packages()
```
Some functions wrap common combos like `mean(x %in% y)` or `sum(is.na(x))`.
```{r counter}
x <- c("VT", "NH", "ZZ", "ME", NA)
prop_in(x, state.abb)
count_na(x)
```
Some functions wrap functions from other packages with different defaults.
```{r count}
dplyr::count(mtcars, cyl)
# sort and add fraction
k5::count2(mtcars, cyl)
```
There are also some handy shortcuts for the `.Last.value` tool.
```{r last, eval=FALSE}
df <- tail(mtcars, 50)
write_last()
#> ℹ `.Last.value` has class 'data.frame'
#> ✓ Saved tab-separated file '/tmp/RtmpFTaCH6/file15127cc7851b.tsv' (1.25K)
vc <- sample(state.name, 1000, replace = TRUE)
write_last()
#> ℹ `.Last.value` has class 'character'
#> ✓ Saved line-separated file '/tmp/RtmpFTaCH6/file151235b67c89.txt' (9.19K)
```
<!-- refs: start -->
[life_badge]: https://img.shields.io/badge/lifecycle-experimental-orange.svg
[life_link]: https://lifecycle.r-lib.org/articles/stages.html#experimental
[cran_badge]: https://www.r-pkg.org/badges/version/k5
[cran_link]: https://CRAN.R-project.org/package=k5
[ga_badge]: https://github.com/k5cents/k5/workflows/R-CMD-check/badge.svg
[ga_link]: https://github.com/k5cents/gluedown/actions
[cov_badge]: https://codecov.io/gh/k5cents/k5/graph/badge.svg?token=VCjNuCUEkS
[cov_link]: https://app.codecov.io/gh/k5cents/k5?branch=master'
[dl_badge]: https://cranlogs.r-pkg.org/badges/grand-total/k5
[gh]: https://github.com/k5cents/k5
[kn]: https://github.com/k5cents
<!-- refs: end -->