Labels for pivot_format
pivot_labels.Rd
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"
)
)
Genre
Categorie
Statistique
male
female
Manquant
Total
Chemistry
Effectif
179
5
0
184
Pourcentage
18.8%
0.5%
0%
19.4%
% colonne
20.6%
9.3%
0%
19.4%
% ligne
97.3%
2.7%
0%
100%
Economic Sciences
Effectif
82
2
0
84
Pourcentage
8.6%
0.2%
0%
8.8%
% colonne
9.4%
3.7%
0%
8.8%
% ligne
97.6%
2.4%
0%
100%
Literature
Effectif
101
15
0
116
Pourcentage
10.6%
1.6%
0%
12.2%
% colonne
11.6%
27.8%
0%
12.2%
% ligne
87.1%
12.9%
0%
100%
Peace
Effectif
90
17
27
134
Pourcentage
9.5%
1.8%
2.8%
14.1%
% colonne
10.4%
31.5%
100%
14.1%
% ligne
67.2%
12.7%
20.1%
100%
Physics
Effectif
210
3
0
213
Pourcentage
22.1%
0.3%
0%
22.4%
% colonne
24.2%
5.6%
0%
22.4%
% ligne
98.6%
1.4%
0%
100%
Physiology or Medicine
Effectif
207
12
0
219
Pourcentage
21.8%
1.3%
0%
23%
% colonne
23.8%
22.2%
0%
23%
% ligne
94.5%
5.5%
0%
100%
Total
Effectif
869
54
27
950
Pourcentage
91.5%
5.7%
2.8%
100%
% colonne
100%
100%
100%
100%
% ligne
91.5%
5.7%
2.8%
100%