Coder Social home page Coder Social logo

styler.equals's Introduction

styler.equals

This package is based on https://github.com/lorenzwalthert/styler.yours

Lifecycle: experimental R-CMD-check

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.

It is a third-party style guide for {styler}.

Installation

You can install the released version of {styler.equals} from GitHub with:

remotes::install_github("robinlovelace/styler.equals")

Example

This is a basic example of how to style code with it.

library(styler.equals)
cache_deactivate()
#> Deactivated cache.
text = "x <- 4
y = 3
a;
"

text_styled_equals = style_text(text)
text_styled_equals
#> x = 4
#> y = 3
#> a

A more complicated example showing that it also fixes other issues from the styler package is:

style_text("a=2", scope = "tokens")
#> a = 2
style_text("a=2", scope = I(c("tokens", "indention")))
#> a=2
style_text(
  "tibble::tibble(
     small  = 2 ,
     medium = 4,#comment without space
     large  = 6
   )"
)
#> tibble::tibble(
#>   small  = 2,
#>   medium = 4, # comment without space
#>   large  = 6
#> )

styler.equals's People

Contributors

robinlovelace avatar robinlovelace-ate avatar lorenzwalthert avatar

Stargazers

Flavio Poletti avatar  avatar  avatar  avatar Søren Havelund Welling avatar John Purnell avatar Jakub Nowosad avatar Andrew Gene Brown avatar Owain  gaunders avatar Leo Lee avatar Shixiang Wang (王诗翔) avatar Srikanth K S avatar Antony Barja  avatar

Watchers

James Cloos avatar  avatar  avatar

styler.equals's Issues

Release styler.equals 0.0.2

First release:

Prepare for release:

  • git pull
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • usethis::use_news_md()
  • git push

How to use as addin for Rstudio

Thank you so much for this package!!

I'm a bit confused by the several options R offers for styling/reformatting your code. Especially when looking at the amazing styler package I get a little bit lost when all I want to do is just change the <- for the =.

Anyways... I was wondering if there is any way (certainly there is as described here r-lib/styler#860 and here https://styler.r-lib.org/reference/styler_addins.html?q=addin ) to use this package here as the formatting option when using the addin from the styler packages. I'm not really understanding how to set the options in the .Rprofile file to make this work.

Especially this sentence:

"To use this style with the addin, you need to create an R package that exports this style guide, and then set the R option styler.addins_style_transformer as described here."
from here r-lib/styler#860 (comment) is confusing me

I tried the following in an .Rprofile file, but this is not right definitly...

library(styler.equals)

options(styler.save_after_styling = TRUE)
options(styler.addins_style_transformer = styler.equals::equals_style())

I'm sorry about any misunderstandings and really grateful for any advises.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.