Learn R Programming

condformat (version 0.10.0)

show_rows: Selects the rows to be printed

Description

Keeps the rows you mention in the printed table. Compared to filter, show_rows does not remove the rows from the actual data frame, they are removed only for printing.

Usage

show_rows(x, ...)

Value

A condformat_show_rows object, usually to be added to a condformat_tbl object as shown in the examples

Arguments

x

condformat_tbl object

...

Expressions used for filtering

See Also

Examples

Run this code
library(condformat)
data(iris)
x <- head(iris)
cf <- condformat(x) %>% show_rows(Sepal.Length > 4.5, Species == "setosa")
if (FALSE) {
print(cf)
}
# Use it programatically
expr_as_text <- 'Sepal.Length > 4.5'
expr <- rlang::parse_expr(expr_as_text)
cf <- condformat(x) %>% show_rows(!! expr)
if (FALSE) {
print(cf)
}
# With multiple arguments:
expr_as_text <- c('Sepal.Length > 4.5', 'Species == "setosa"')
exprs <- lapply(expr_as_text, rlang::parse_expr)
cf <- condformat(x) %>% show_rows(!!! exprs)
if (FALSE) {
print(cf)
}

Run the code above in your browser using DataLab