In this first line I am trying to pull out all observations that have 5228 and this works.

hlthc5228_df <- proddesc_df$MAJOR_CAT_CD == 5228

summary(hlthc5228_df)

Mode FALSE TRUE

logical 46955 515837

But, I would like to pull out the number of observations that have 5228 with the total number of quantity. So if the quantity was 6, then the total # of codes with 5228 is 6, or if Quantity is 1, then total number of codes with 5228 is 1.

Tried this:

hlthc5228_df <- proddesc_df$MAJOR_CAT_CD == 5228 proddesc_df$SLS_QTY >= '1'