Count Number of Rows by Group Using dplyr Package in R (Example) | group_by, summarise & n Functions

Описание к видео Count Number of Rows by Group Using dplyr Package in R (Example) | group_by, summarise & n Functions

How to return the number of cases in each group of a data frame using the functions of the dplyr package in the R programming language. More details: https://statisticsglobe.com/count-num...
R code of this video:

data <- data.frame(x1 = 1:10, # Example data
x2 = letters[1:10],
group = c("A", "A", "A",
"B", "B", "B", "B",
"C", "C",
"D"))

install.packages("dplyr") # Install dplyr package
library("dplyr") # Load dplyr

data %>% # Count rows by group
group_by(group) %>%
summarise(n = n())

Follow me on Social Media:
Twitter:   / joachimschork  
Facebook:   / statisticsglobecom  
Reddit:   / joachimschork  
Pinterest: https://www.pinterest.de/JoachimSchork

Комментарии

Информация по комментариям в разработке