R to access columns

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.

+1
r aggregate order dataframe
Sep 16 '15 at 19:07
source share

No one has answered this question yet.

See similar questions:

13
Multiple functions in one application or aggregate application
0
R: the result of a combination with many functions not used in further calculations. WHAT FOR?

or similar:

1553
Renaming columns in pandas
1462
How to iterate over rows in a DataFrame in Pandas?
1419
Select rows from a DataFrame based on values โ€‹โ€‹in a column in pandas
1251
How to sort a data frame by multiple columns
1033
Remove column from panda DataFrame
889
Select multiple columns in pandas data frame
879
Get a list of pandas DataFrame column headers
815
Adding a new column to an existing DataFrame in Python pandas
779
Group by multiple columns
773
Removing columns of a data frame by name



All Articles