[R] Odp: tabulating 2 factors weighting by a third var
petr.pikal at precheza.cz
Mon Dec 20 08:10:36 CET 2010
r-help-bounces at r-project.org napsal dne 20.12.2010 07:07:35:
> This must be an easy one but so far I haven't find a way out...
> I have a data frame such as:
> $ v1 : Factor w/ 5 levels
> $ v2 : Factor w/ 2 levels
> $ v3 : Class 'difftime' atomic [1:6666]
> basically v1 and v2 are factors, while v3 is a variable containing the
> duration of certain activities (values ranging from 11 to 45000 sec, no
> How can I get a table such that v1 levels will show as rows, v2 levels
> columns and v3 is the weight by which table(v1,v2) is weighted? That is,
> instead of getting the count of occurences in each of the 10 cells of
> (v1,v2) I would like to get the sum(v3), how can it be done?
is other option.
> Luca Meyer
> IBM SPSS Statistics release 19.0.0
> R version 2.12.1 (2010-12-16)
> Mac OS X 10.6.5 (10H574) - kernel Darwin 10.5.0
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help