How to resolve group_by error in aggregate function in R




While trying to do aggregation using aggregate and sqldf aggregate functions throws up an error while sqldf works fine.

The churned is numeric with 1/0 values and State is character.I am trying to view the number of churns by state.
How do I resolve this error in aggregate?Can someone please help me with this?


Can you provide some of the entries in the database? The question is very ambiguous at this stage.


Hi @Harshita_Dudhe,

SampleData.csv (4.4 KB)


The aggregate function is using an object called data for its values. But you just created an object called state_churn before it.

Why did you show us state_churn and then not even use it in the next function? Is that a typo?