show_columns: Selects the variables to be printed

Description Usage Arguments Value See Also Examples

View source: R/show_columns.R

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(...)

show_columns_new(x, columns, col_names)

Arguments

...

Dots are used to transition from the old syntax show_columns_old to the new one

x

A condformat object, typically created with 'condformat(x)'

columns

A character vector with column names to be coloured. It can also be an expression can be used that will be parsed like in 'tidyselect::vars_select'. See examples.

col_names

Character vector with the column names for the selected columns

Value

The condformat object with the rule added

See Also

select

Examples

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

# Include some columns:
condformat(x) %>% show_columns(c(Sepal.Length, Sepal.Width, Species))
condformat(x) %>% show_columns(c("Sepal.Length", "Sepal.Width", "Species"))

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

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

condformat(x) %>% show_columns(c(starts_with("Petal"), Species))

petal_width <- "Petal.Width"
condformat(x) %>% show_columns(!! petal_width)

condformat documentation built on Nov. 17, 2017, 7:34 a.m.