Check the *apply() series of functions. tapply() will do what you want.
attach(mtcars)
tapply(hp,list(cyl,gear),mean)
HTH,
Daniel
Mark Alen wrote:
>
> I know commands like xtabs and table allow a user to do cross-tabulation
> For example the following command generates a pivot table that sh
I know commands like xtabs and table allow a user to do cross-tabulation
For example the following command generates a pivot table that shows the number
of cars that have the same number of gears and cylinders.
>xtabs(~cyl+gear,data =mtcars)
gear
cyl 3 4 5
4 1 8 2
6 2 4 1
812 0 2
>
We
2 matches
Mail list logo