DropEmpty

0th

Percentile

DropEmpty pseudo-function

Pseudo-function to indicate that rows or columns containing no observations should be dropped.

Usage
DropEmpty(empty = "", which = c("row", "col", "cell"))
Arguments
empty

String to use in empty cells.

which

A vector indicating what should be dropped. See the Details below.

Details

If the which argument contains "row", then any row in the table in which all cells are empty will be dropped. Similarly, if it contains "col", empty columns will be dropped. If it contains "cell", then cells in rows and columns that are not dropped will be set to the empty string.

Pseudo-functions

This is a “pseudo-function”: it takes the form of a function call, but is never actually called: it is handled specially by tabular.

Aliases
  • DropEmpty
Examples
# NOT RUN {
df <- data.frame(row = factor(1:10), value = rnorm(10))
subset <- df[sample(10, 5),, drop = FALSE]

# Some rows did not get selected, so this looks ugly
tabular(row ~ value*mean, data = subset)

# This only shows rows with data in them
tabular(row*DropEmpty() ~ value*mean, data = subset)

# This shows empty cells as "(empty)"
tabular(row*DropEmpty("(empty)", "cell") ~ value*mean, data = subset)
# }
Documentation reproduced from package tables, version 0.8.8, License: GPL-2

Community examples

Looks like there are no examples yet.