View source: R/cube-index-table.R
index.table | R Documentation |
Index tables are percentages of percentages. They take the percentage from
prop.table(cube, margin)
and, by default, divide that by the proportions of
the other margin. The baseline
argument can be used to provide baseline
proportions to compare against.
index.table(x, margin, baseline)
x |
A CrunchCube to calculate index table for |
margin |
which margin to index against (1 for rows, 2 for columns) |
baseline |
an arbitrary set of proportions to compare the table given in
|
index.table()
is only implemented for 2 dimensional cubes. If you need to
calculate indexes for a higher dimension Cube, please slice the cube first.
an array of percentages indexed to the margin provided
## Not run:
cube_object
# v7
# v4 C E
# B 5 2
# C 5 3
index.table(cube_object, 1)
# v7
# v4 C E
# B 107.1429 85.71429
# C 93.7500 112.50000
index.table(cube_object, 2)
# v7
# v4 C E
# B 100 80
# C 100 120
index.table(cube_object, 2, c(0.6, 0.4))
# v7
# v4 C E
# B 83.33333 66.66667
# C 125.00000 150.00000
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.