Package 'codegrip'

Title: Syntax-Based Editing and Navigation of R Code
Description: Provides addins for reshaping R code and navigating across syntactic constructs.
Authors: Lionel Henry [aut, cre], Posit PBC [cph, fnd]
Maintainer: Lionel Henry <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2024-12-02 05:43:32 UTC
Source: https://github.com/lionel-/codegrip

Help Index


Reshape expressions longer or wider

Description

addin_reshape() lets you cycle between different shapes of function calls. For instance, reshaping transforms code from wide to long shape and vice versa:

list(a, b, c)

list(
  a,
  b,
  c
)

Note that for function definitions, addin_reshape() cycles through two different long shapes. The traditional L form uses more horizontal space whereas the flat form uses less horizontal space and the arguments are always aligned at single indent:

foo <- function(a, b, c) {
  NULL
}

foo <- function(a,
                b,
                c) {
  NULL
}

foo <- function(
  a,
  b,
  c
) {
  NULL
}

Usage

addin_reshape()