[R] Frequency table

Robin Evans rje42 at stat.washington.edu
Sat Apr 17 08:24:33 CEST 2010


> but I need to incorporate the speed values and have a table like the
> following:
>                 1     2     3     4     5     6 .... 36
> 0-9
> 10-19
> 20-29
> 30-39
> 40-49
> 50+
> The final table will be used in the rosavent function to produce a wind rose
> diagram just like in this example:

The table() command will accept an arbitrary number of factors as its
first arguments, and cross tabulate the frequencies for all of them.
So

table(cut(Wind_Dir_vec, 0:36), cut(Wind_Speed, seq(9.5, to=49.5, by=10)))

should do more or less what you want.

> --
> Kevin Turner
> Department of Geography
> and Environmental Studies
> Wilfrid Laurier University
> Waterloo, Ontario
> [[alternative HTML version deleted]]

-- 
Robin Evans
Statistics Department
University of Washington
www.stat.washington.edu/~rje42



More information about the R-help mailing list