frequency counts with categorical variables

Viewed 84

I have two categorical variables.

Variable A has about 15 levels and Variable B is dummy coded (0,1)

I am looking to get a table with the frequency counts of 1's in Variable B for each of the 15 levels of Variable A.

1 Answers

We can use table from base R after subsetting the columns of interest

table(df1[c('A', 'B')])
Related