unpivot: Unpivot

View source: R/unpivot.R

unpivotR Documentation

Unpivot

Description

From a pivot_table object put column(s) back as rows.

Usage

unpivot(x)

Arguments

x

A pivot_table object.

Value

a data.table.

Examples

library(flexpivot)
library(magrittr)
data("nobel_laureates")

# Revert format
nobel_laureates %>%
  pivot_table(
    rows = "category",
    cols = c("gender", "birth_continent")
  ) %>%
  unpivot()

nobel_laureates %>%
  pivot_table(
    rows = "category",
    cols = "birth_continent"
  ) %>%
  unpivot()


dreamRs/flexpivot documentation built on Oct. 26, 2023, 9:46 a.m.