Skip to contents

Creates a pivot_table object from a data frame. Additional information associated with the pivot table can be indicated. The data frame data is converted to character data type.

Usage

pivot_table(
  df,
  page = "",
  page_row = 0,
  page_col = 0,
  n_col_labels = 0,
  n_row_labels = 0
)

Arguments

df

A data frame, contains one or more pivot tables.

page

A string, additional information associated with the pivot table.

page_row, page_col

A cell (row and column number), page information included in the table.

n_col_labels

A number, number of columns containing pivot table labels.

n_row_labels

A number, number of rows containing pivot table labels.

Value

A pivot_table object.

See also

divide

Other pivot table definition functions: define_labels(), get_page(), set_page()

Examples


pt <- pivot_table(df_ex)

pt <- pivot_table(df_ex, page = "M4")

pt <- pivot_table(df_ex, page_row = 1, page_col = 1)

pt <- pivot_table(df_ex, page_row = 1, page_col = 1, n_col_labels = 2, n_row_labels = 2)