Skip to contents

Remove rows and columns without data from the pivot table represented by the object.

Usage

remove_empty(pt)

# S3 method for pivot_table
remove_empty(pt)

Arguments

pt

A pivot_table object.

Value

A pivot_table object.

Details

A pivot table should only contain label rows and columns, and an array of values, usually numeric data.

All rows and columns not belonging to the pivot table must be removed, including those without data.

See also

Examples


df <- df_ex
df[seq(from = 1, to = 25, by = 2), ] <- " "
df[, seq(from = 1, to = 7, by = 2)] <- " "
pt <- pivot_table(df)
pt <- pt |> remove_empty()