Selects the variables to be printed

Description

Keeps the variables you mention in the printed table. Compared to select, show_columns does not remove the columns from the data frame, so formatting rules can still depend on them.

Usage

1
2
3
show_columns(..., col_names)

show_columns_(..., .dots, col_names)

Arguments

...

Comma separated list of unquoted extensions.

col_names

Character vector with the column names for the selected columns

.dots

Use select_() to do standard evaluation. See vignette("nse") for details

Value

A condformat_show_columns object, usually to be added to a condformat_tbl object

See Also

select

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(dplyr) # for starts_with()
data(iris)
x <- head(iris)

# Include some columns:
condformat(x) + show_columns(Sepal.Length, Sepal.Width, Species)

# Rename columns:
condformat(x) + show_columns(Sepal.Length, Species, col_names = c("Length", "Spec."))

# Exclude some columns:
condformat(x) + show_columns(-Petal.Length, -Petal.Width)

# Select columns using dplyr syntax:
condformat(x) + show_columns(starts_with("Petal"), Species)


# Use standard evaluation (columns as strings):
condformat(x) +
  show_columns_(.dots = c("Sepal.Length", "Species"), col_names = c("Sepal Length", "Species"))