Suppose I have a data frame as:
id value
1 "hi"
1 "hi"
1 "hi again"
1 "hi again"
2 "hello"
2 "hi"
Now I want to get the count of each value for each of the distinct values in id column. The output would be like
id value Freq
1 "hi" 2
1 "hi again" 2
2 "hello" 1
2 "hi" 1
I tried splitting up the first data frame for each distinct id and get the frequency using the table() function on the value column and appending the id column later. Also, I end up with a lot of dataframes in my memory. I just want to know if I can achieve the above dataframe without chewing up my memory with lot of dataframes(as I have almost 5 million rows).