Hello helpers,

This is probably quite simple, but I'm stuck.

 I want to create a summary statistics table with frequencies and summary
statistics for a large number of variables. The problem here is that (1)
there are two different classes of categories (sex, type of substance abuse
and type of treatent) which overlap, (2) the data for different variables
should be presented in different ways -- sometimes with relative
frequencies, other times with mean values.

The table would finally look something like:

                   All  Male  Female Alcohol Drug ...
Age             (mean) (mean) ...
Sex (% male)    (freq) (freq) ...
Alcohol CS      (mean) (mean) ...
...              ...

Data is in a data frame with quite a lot of columns (variables) and each row
represents a single case.

I have found out that part of this can be done with tapply, for example
tapply(age, sex, mean) and join it with tapply(age, abuse, mean). But how to
do with frequencies? Or is there an even simpler way?

/S

	[[alternative HTML version deleted]]


