How to resolve variable lengths differ error in aggregate function in R

aggregation

#1

Hello

I am trying to use the aggregate function in the below manner:

aggr_attributes_state <- aggregate(c("Total.Day.Minutes","Total.Day.Charge") ~ State,
                                   data = dm.data,FUN = mean)

So basically I want two aggregations by State,one for Day Minutes and one for Day Charge.However this is throwing up an error:


What does this error mean and how do I achieve the desired result??
Or do I have to create separate data frames for each aggregation??