pivot_labels: Labels for 'pivot_format'

View source: R/pivot_format.R

pivot_labelsR Documentation

Labels for pivot_format

Description

Labels for pivot_format

Usage

pivot_labels(
  stats = "Statistic",
  n = "N",
  p = "%",
  p_col = "Col %",
  p_row = "Row %",
  rows = NULL,
  cols = NULL
)

Arguments

stats

Name of statistics column.

n

Count.

p

Percentage.

p_col

Column perc.

p_row

Row perc.

rows, cols

Labels for variables use as rows/cols.

Value

a list that can be use in pivot_format.

Examples

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

# Change labels displayed in table
nobel_laureates %>%
  pivot_table("category", "gender", na_label = "Manquant") %>%
  pivot_format(
    labels = pivot_labels(
      stats = "Statistique",
      n = "Effectif",
      p = "Pourcentage",
      p_col = "% colonne",
      p_row = "% ligne",
      rows = c("Categorie"),
      cols = "Genre"
    )
  )

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