4

I'm starting to use the rpivotTable function:

library(rpivotTable)
rpivotTable(mtcars, rows="gear", col="cyl", aggregatorName="Average", 
vals="mpg", rendererName="Bar Chart")

With this code I have the average mpg by cyl and gear. What if I would like compute the weighted average mpg with hp? I should create my aggregator! I read here that it's possible. But how then pass it to R ?

nicolaskruchten
  • 26,384
  • 8
  • 83
  • 101
dax90
  • 1,088
  • 14
  • 29
  • Sorry for the long delay ;). I'm the creator of the package (on top of the marvellous work of the creator of `pivottable.JS`). Thanks for using `rpivotTable`. While in JavaScript it make sense to use custom aggregators, in `R` you can simply add a column with the `weighted average mpg with hp`. – Enzo Apr 19 '17 at 20:10

0 Answers0