https://github.com/robinlovelace/styler.equals
A style for equals assignment, based on the styler package
https://github.com/robinlovelace/styler.equals
Last synced: 2 months ago
JSON representation
A style for equals assignment, based on the styler package
- Host: GitHub
- URL: https://github.com/robinlovelace/styler.equals
- Owner: Robinlovelace
- License: other
- Created: 2022-08-07T21:36:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T21:09:47.000Z (about 1 year ago)
- Last Synced: 2024-06-11T16:10:15.880Z (12 months ago)
- Language: R
- Size: 104 KB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{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
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://github.com/Robinlovelace/styler.equals/actions/workflows/R-CMD-check.yaml)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
)"
)
```