Hi All,
What is the dplyr's equivalent of plyr's count () function ?
I want to calculate simply an occurences of a values in a column of dataframe using dplyr.
library(plyr)
df3 <- structure(list(Var1 = structure(1:15, .Label = c("4", "5", "23",
"34", "43", "54", "56", "65", "67", "324", "435", "453", "456",
"567", "657"), class = "factor"), Var2 = c(2L, 1L, 2L, 2L, 1L,
1L, 2L, 1L, 2L, 1L, 3L, 1L, 1L, 1L, 1L)), class = "data.frame", row.names = c(NA,
-15L))
plyr::count(df3$Var2)
#> x freq
#> 1 1 9
#> 2 2 5
#> 3 3 1
Created on 2020-04-11 by the reprex package (v0.3.0)