-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
59 lines (47 loc) · 1.88 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include=FALSE}
library(pedant)
test_dir <- file.path(tempdir(), "testing")
dir.create(test_dir)
knitr::opts_knit$set(
root.dir = test_dir
)
```
<!-- badges: start -->
[](https://github.com/wurli/pedant/actions)
<!-- badges: end -->
# {pedant} <img src="man/figures/logo.png" align="right" width="200" />
`{pedant}` lets you quickly transform R code to *pedantically* use explicit
function calls instead of implicit, either by running `add_double_colons()` or
using the handy RStudio addin `"Make function calls explicit"`.
{width=75%}
# Installation
You can install the development version using
``` r
remotes::install_github("wurli/pedant")
```
# Usage
If you're developing a package, `{pedant}` will look at the `DESCRIPTION` and
`NAMESPACE` files to work out which packages to use when making functions
explicit. Otherwise it will use the currently attached packages, i.e.
the ones already loaded using `library()`. You can manually specify the
packages to look in using the `use_packages` argument to `add_double_colons()`:
```{r}
library(dplyr, warn.conflicts = FALSE)
code <-
"mtcars %>%
filter(mpg > 20) %>%
summarise(across(everything(), n_distinct))"
# Code will be transformed to use the double-colon operator, but notice
# that `n_distinct` is not transformed as it is not followed by `()`
cat(add_double_colons(code))
```
# Why?
Often, during package development I forget to use explicit function calls and
am then faced with the onerous task of cleaning up my own code. I wrote this
package so I can continue this bad habit.
# Bug reports / feature requests
Please post these as issues on [github](https://github.com/wurli/pedant/issues)