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'

I will try that suggestion, Thank you.
Not sure if this helps:
I am trying to pull out the number of products sold that have a product code of 5228.
I have a column of product codes. I have a column of quantity sold.
I want to find out how many quantity sold of each product code.

One you want the number of products sold that have a product code of 5228.

Two I want to find out how many quantity sold of each product code.

Okay, if I have this correctly what you want is the number of items sold by product code.

Here is a toy example,

## create a toy data set.
dat1 <- data.frame(xx = sample(letters[1:5], 100, replace = TRUE), yy = (sample(1:12, 100, replace = TRUE)))
## count the number of times the product code appears in the data
dat2 <- dat1 %>% group_by(xx) %>%
summarize( n = n())
dat2

In the second line of code you want to replace dat1 with the name of your data.frame or tibble. Then replace xx with the name of the column of product codes and you should be fine.