Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Why we need ungroup function while grouping more than one variable in dplyr package?

$
0
0

@harry wrote:

I am forming a data frame using dplyr package in R in which I am grouping data set by two variable .

grouping=group_by(pf,age,gender) #pf is the data set and age and gender are variable

Then I have created a data frame using dplyr package

pf.fc_by_age_gender=summarise(grouping,mean_friend_count=mean(friend_count),median_friend_count=median(friend_count),n())

I want to know why it is necessary to ungroup the data frame before arranging the data frame.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles