Skip to contents

Sets vertical rules (column separators) for the table. Calling fr_vlines() again replaces all previously set vertical rules. Horizontal rules set by fr_hlines() are not affected.

Usage

fr_vlines(
  spec,
  preset = "box",
  cols = NULL,
  width = NULL,
  color = NULL,
  linestyle = NULL,
  abovepos = NULL,
  belowpos = NULL
)

Arguments

spec

An fr_spec object from fr_table().

preset

Named rule preset or "void" (no vertical rules):

  • "box" — rules on the leftmost and rightmost table edges only (outer vertical borders). Default.

  • "all" — rules between every column and on outer edges.

  • "inner" — rules between columns only; no outer edges.

  • "void" — no vertical rules. Clears all previously set vlines.

cols

Integer vector of column gap positions to rule. Position j draws a rule to the right of column j. Use alongside preset = "void" to add individual column separators. NULL uses the preset.

width

Rule width. Named shorthand ("hairline", "thin", "medium", "thick") or numeric in points. Default NULL (thin, 0.5 pt).

color

Rule colour: hex string or CSS named colour. NULL = black.

linestyle

One of "solid" (default), "dashed", "dotted", "dashdot", "double".

abovepos, belowpos

Fractions (0–1) controlling partial vertical extent of the rule within a row. NULL = full height (default).

Value

A modified fr_spec. Vertical rules stored in spec$rules.

Preset comparison

PresetLeft edgeBetween colsRight edgeUse case
"box"YesNoYesClean outer border (most common)
"all"YesYesYesFull grid with column separators
"inner"NoYesNoColumn separators, open sides
"void"NoNoNoNo vertical rules

Regulatory conventions

Most pharma TFL outputs use no vertical rules ("void") or just an outer box border ("box"). Full grids ("all") are uncommon in regulatory submissions but may be used for dense listing tables or shift tables where column boundaries aid readability.

Tips

  • fr_vlines("box") is the most common use — a clean outer border.

  • Combine with fr_hlines("header") for the typical pharma style: box outer border + single rule under the column header.

  • cols = c(1L, 3L) draws a rule to the right of columns 1 and 3 — useful for separating a stub column from data columns.

  • fr_vlines() and fr_hlines() are independent — each manages its own rules. To set both at once, use fr_grid().

See also

fr_hlines() for horizontal rules, fr_grid() to set both in one call, fr_styles() for cell shading and font styling.

Examples

## ── Common presets ────────────────────────────────────────────────────────

# Outer box border only (most common)
tbl_demog |> fr_table() |> fr_vlines("box")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules:

# Rules between every column
tbl_demog |> fr_table() |> fr_vlines("all")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules:

# Inner column separators only (no outer edges)
tbl_demog |> fr_table() |> fr_vlines("inner")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules:

# Remove all vertical rules
tbl_demog |> fr_table() |> fr_vlines("void")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom

## ── Custom column positions ───────────────────────────────────────────────

# Rule after the stub column (column 1) only
tbl_demog |>
  fr_table() |>
  fr_vlines("void") |>
  fr_vlines(cols = 1L)
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules:

## ── Custom width, style, and colour ────────────────────────────────────────

# Thick outer box
tbl_demog |> fr_table() |> fr_vlines("box", width = "thick")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules:

# Dashed inner separators
tbl_demog |> fr_table() |> fr_vlines("all", linestyle = "dashed")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules:

# CSS named colour
tbl_demog |> fr_table() |> fr_vlines("box", color = "slategray")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules:

## ── Combined with fr_hlines ───────────────────────────────────────────────

# Typical regulatory pharma style
tbl_demog |>
  fr_table() |>
  fr_hlines("header") |>
  fr_vlines("box")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules: 1 hline(s)

# Full grid: all borders
tbl_demog |>
  fr_table() |>
  fr_hlines("hsides") |>
  fr_vlines("all")
#> 
#> ── fr_spec: Table 
#> Data: 28 rows x 6 columns
#> Page: landscape letter, 9pt Courier New
#> Header: valign=bottom
#> Rules: 2 hline(s)