Learn R Programming

openxlsx2 (version 0.6.1)

wb_add_filter: Add column filters

Description

Add excel column filters to a worksheet

Usage

wb_add_filter(wb, sheet = current_sheet(), rows, cols)

Arguments

wb

A workbook object

sheet

A name or index of a worksheet

rows

A row number.

cols

columns to add filter to.

Details

adds filters to worksheet columns, same as filter parameters in write_data. write_datatable automatically adds filters to first row of a table. NOTE Can only have a single filter per worksheet unless using tables.

See Also

write_data()

wb_add_filter()

Examples

Run this code
wb <- wb_workbook()
wb$add_worksheet("Sheet 1")
wb$add_worksheet("Sheet 2")
wb$add_worksheet("Sheet 3")

wb$add_data(1, iris)
wb$add_filter(1, row = 1, cols = seq_along(iris))

## Equivalently
wb$add_data(2, x = iris, withFilter = TRUE)

## Similarly
wb$add_data_table(3, iris)

Run the code above in your browser using DataLab