getSetSizes.Rd
Count total number of items in each set
getSetSizes(df, setNames)
df | A data frame indicating set membership |
---|---|
setNames | A character vector of set names |
A data frame with variables set
and N
indicating the
number of items in each set
The input data frame should contain a row for each item and a binary variable
for each set indicating the membership of each item. The setNames
input should correspond to the binary indicator columns in the data frame.
# Define set names data("movieSets") setNames <- colnames(movieSets[,-c(1:8)]) # Calculate set sizes getSetSizes(movieSets, setNames)#> # A tibble: 19 x 2 #> set N #> <fct> <dbl> #> 1 Action 3520 #> 2 Adventure 2329 #> 3 Animation 1027 #> 4 Children 1139 #> 5 Comedy 8374 #> 6 Crime 2939 #> 7 Documentary 2471 #> 8 Drama 13344 #> 9 Fantasy 1412 #> 10 Film-Noir 330 #> 11 Horror 2611 #> 12 IMAX 196 #> 13 Musical 1036 #> 14 Mystery 1514 #> 15 Romance 4127 #> 16 Sci-Fi 1743 #> 17 Thriller 4178 #> 18 War 1194 #> 19 Western 676