[R] Percent of a given subset
David Winsemius
dwinsemius at comcast.net
Sat Jun 9 04:46:38 CEST 2012
On Jun 8, 2012, at 6:15 PM, jcrosbie wrote:
>
> How would I find the Percent of FuelTypeNum within the Band given
> AvailableMW?
>
> example:
> type 1 is 1% of PB0
> type 2 is 54% of PB0
> type 4 is 4% of PB0
> type 5 is 42% of PB0
format( 100*prop.table(table(dfrm$FuelTypeNum)), 0 )
... should do it.
>
>
>
> Note: the Bands and fuel types are not always constant.
>
> Data:
> FuelTypeNum Bands AvailableMW AvailableMWNewFormat
> 1 PB0 185319 185.319
> 2 PB0 18352000 18352
> 4 PB0 1338785 1338.785
> 5 PB0 14189756 14189.756
> 2 PB1 48229 48.229
> 5 PB1 792433 792.433
> 2 PB2 7034959 7034.959
> 4 PB2 796 0.796
> 5 PB2 1652519 1652.519
> 1 PB3 16 0.016
> 2 PB3 11633 11.633
> 4 PB3 8076 8.076
> 5 PB3 97410 97.41
> 1 PB4 4610 4.61
> 2 PB4 3048 3.048
> 4 PB4 1117 1.117
> 5 PB4 28097 28.097
> 1 PB5 1155 1.155
> 2 PB5 5331 5.331
> 4 PB5 2491 2.491
> 5 PB5 12887 12.887
> 1 PB6 4 0.004
> 2 PB6 5774 5.774
> 4 PB6 2643 2.643
> 5 PB6 25475 25.475
> 1 PB7 133 0.133
> 2 PB7 3787 3.787
> 4 PB7 750 0.75
> 5 PB7 10682 10.682
> http://r.789695.n4.nabble.com/file/n4632857/Rdata.xlsx Rdata.xlsx
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Percent-of-a-given-subset-tp4632857.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list