Cum average expression function
I have a data function that will create a cumulate average rate based upon a grouping that is controlled by a document property. Plotting this value is a nice smooth cumulative curve instead of plotting a cumulate curve in a line plot and average the using line by or color by for a specific group, this curve can bet pretty jagged at the end as data falls out becuase they are not all the same time length.
I have tried to create an expression function the will average the data and then cum it, however, I can't seem to get the right combinations. I read that the number of row coming in must equal the rows coming out while using an expression function, does anyone have a solution for this?
Any help would be greatly appreciated!
I am using a simple average junction shown below.
input1[is.na(input1)] <- 0
data <- data.frame(Water = input1, Days = input2)
output = aggregate(Water ~ Days, data=data, FUN=mean)