Skip to content
A Tidy R Code Style
R
Branch: master
Clone or download
gadenbuie add username to `install_github()` call (#1)
add username to `install_github()` call
Latest commit a141d39 Aug 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R grkstyle Aug 6, 2019
man grkstyle Aug 6, 2019
.Rbuildignore pkg setup Aug 6, 2019
.gitignore pkg setup Aug 6, 2019
DESCRIPTION Add GitHub links to DESCRIPTION Aug 6, 2019
LICENSE pkg setup Aug 6, 2019
LICENSE.md pkg setup Aug 6, 2019
NAMESPACE pkg setup Aug 6, 2019
README.Rmd add username to `install_github()` call Aug 11, 2019
README.md add username to `install_github()` call Aug 11, 2019
grkstyle.Rproj pkg setup Aug 6, 2019

README.md

grkstyle

grkstyle is an extension package for styler that holds my personal code style preferences.

Installation

You can install the grkstyle from Github

# install.packages("devtools")
devtools::install_github("gadenbuie/grkstyle")

Usage

To use grkstyle by default in styler functions and addins

# Set default code style for {styler} functions
grkstyle::use_grk_style()

Or add the following to your ~/.Rprofile

options(styler.addins_style_transformer = "grkstyle::grk_style_transformer()")

Examples

A few examples drawn from the tidyverse style guide.

Line Breaks Inside Function Calls

unstyled

do_something_very_complicated(something = "that", requires = many,
                              arguments = "some of which may be long")

grkstyle

do_something_very_complicated(
  something = "that",
  requires = many,
  arguments = "some of which may be long"
) 

styler::tidyverse_style

do_something_very_complicated(
  something = "that", requires = many,
  arguments = "some of which may be long"
) 

Indentation of Function Arguments

unstyled

long_function_name <- function(a = "a long argument",
                               b = "another argument",
                               c = "another long argument") {
  # As usual code is indented by two spaces.
}

grkstyle

long_function_name <- function(
  a = "a long argument",
  b = "another argument",
  c = "another long argument"
) {
  # As usual code is indented by two spaces.
} 

styler::tidyverse_style

long_function_name <- function(a = "a long argument",
                               b = "another argument",
                               c = "another long argument") {
  # As usual code is indented by two spaces.
} 
You can’t perform that action at this time.