I have a data with a column which mentions the gender of a person. Unfortunately there are few misplaced columns/erroneous values.
summary(data$gender)
gives something like
boy : 19232
girl : 14565
Maths : 3
Science : 4
... some 20 garbage values : 1
I wrote a code to replace values other than boy, girl to error. Now summary(data$gender) gives something like
boy : 19232
error : 156
girl : 14565
Maths : 0
Science : 0
... other garbage values : 0
Is there any way I can prevent printing values for which count is 0?
Why I need this - There are more than 100 columns. I am using a new flag column which is set to 1 when it encounters an "error" across any cell value, and in the end, I delete the records with flag=1. I need to view a short summary of the entire data., something like
boy : 19232
error : 156
girl : 14565
Thanks for any help in advance!