Kickstarting R - Breakdown

Displaying means for levels of a factor

Cranking out group means is likely to be one of the first things you have to do in many analyses. brkdn() is a function using a formula again to describe how the data should be broken down.

This function successively peels off terms of the formula until there is only one term (factor) on the right side. Each time it encounters a factor, it prints the means for the levels of that factor, calling itself recursively if there is more than one factor to process. The display is therefore a hierarchical listing of means starting from the last factor on the right side of the formula.

Notice also that the maximum number of levels may be limited, with a default of 10. This is a bit of insurance in case a variable with a huge number of levels slips in as a factor. If you really want more than 10 levels for any variable, you can pass the appropriate value.

Back to Table of Contents