On Wed, 2007-10-03 at 21:31 +0000, lamack lamack wrote:
> Dear all, there is an R function do a frequency table considering a weight 
> variable?
>  
> M A 23
> M B 34
> F A 23
> F B 45
>  
> I would like a table like this
>  
>       A       B
> M   23     34
> F   23      45

See ?xtabs

For example, given a data frame 'DF':

> DF
  V1 V2 V3
1  M  A 23
2  M  B 34
3  F  A 23
4  F  B 45


> xtabs(V3 ~ V1 + V2, DF)
   V2
V1   A  B
  F 23 45
  M 23 34

HTH,

Marc Schwartz

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to