generated from lorenzwalthert/styler.yours
-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
77 lines (57 loc) · 1.92 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
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# styler.equals
This package is based on https://github.com/lorenzwalthert/styler.yours
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/Robinlovelace/styler.equals/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Robinlovelace/styler.equals/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
The goal of {styler.equals} is to provide an implementation of the 'equals style' used by Yuhei Xie, Colin Gillespie and many in the `#rspatial` community.
So far it basically just the 'tidyverse style' but with equals assignment.
In the future it may evolve, e.g. to implement the [Geocomputation with R style guide](https://github.com/geocompx/geocompr/blob/main/misc/our-style.md).
It is a third-party
style guide for [{styler}](https://styler.r-lib.org).
## Installation
You can install the released version of {styler.equals} from [GitHub](https://github.com) with:
``` r
remotes::install_github("robinlovelace/styler.equals")
```
```{r, include=FALSE}
devtools::load_all()
```
## Example
This is a basic example of how to style code with it.
```{r example}
library(styler.equals)
cache_deactivate()
text = "x <- 4
y = 3
a;
"
text_styled_equals = style_text(text)
text_styled_equals
```
A more complicated example showing that it also fixes other issues from the `styler` package is:
```{r}
style_text("a=2", scope = "tokens")
style_text("a=2", scope = I(c("tokens", "indention")))
```
```{r}
style_text(
"tibble::tibble(
small = 2 ,
medium = 4,#comment without space
large = 6
)"
)
```