I made the aggregate using the mean, length, and sum as follows:
BH_claims_agg <- aggregate(BH_claims$paid_amt, + list(rend_tin=BH_claims$rend_tin,prov_desc=BH_claims$prov_desc), + FUN=function(x) c(mn=mean(x), n = length(x), tot = sum(x)))
When I make a head in the resulting data frame, I get these headers:
rend_tin prov_desc x.mn xn x.tot
However, when I do dim , it reports that my structure has only 3 columns, rend_tin , prov_desc and x . Of course, when I try to arrange my structure in the x.mn column, it gives an error.
How do I get a 5-column structure from a 3-column structure to order it.
r aggregate order dataframe
Mark Ginsburg Sep 16 '15 at 19:07 2015-09-16 19:07
source share