# Create small px object example
x0 <- px(subset(population_gl, age == "65+"))
x0$data
# Add total level to one variable
x1 <- px_add_totals(x0, "gender")
x1$data
# Add total level to multiple variables
x2 <- px_add_totals(x0, c("gender", "age"))
x2$data
# The name of the total level can be changed with px_elimination()
x3 <-
x0 |>
px_elimination("T") |>
px_add_totals("gender")
x3$data
Run the code above in your browser using DataLab