Skip to content

Parenthesised [] pipelines #474

@jrosell

Description

@jrosell

Sorry if not relevant, I was not capable of finding my answer in the docs and there's no discussion Q&A section in this repo, so I ask my question here.

I want to have my project to format the code in this way:

library(data.table)
cw <- data.table(ChickWeight)

# fmt: skip
cw21 <- (
  cw[Time %in% c(0, 21)]
  [, Weight := weight] 
  [, Group := factor(paste0("Diet_", Diet))]
  [, .(Chick, Group, Time, Weight)]
  [order(Chick, Time)]
  [1:5]
)

By default, is formatted this way:

# Air formatter by default
cw21 <- (cw[Time %in% c(0, 21)][, Weight := weight][,
  Group := factor(paste0("Diet_", Diet))
][, .(Chick, Group, Time, Weight)][order(Chick, Time)][1:5])

I tried different options in air.toml file skip formatting options, but I'm lost.

# Air formatter with air.toml with [format] skip = ["[", "]", "`[`", "`]`"]
cw21 <- (cw[Time %in% c(0, 21)][, Weight := weight][,
  Group := factor(paste0("Diet_", Diet))
][, .(Chick, Group, Time, Weight)][order(Chick, Time)][1:5])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions