Is there way to apply median imputation method on the column Income_category based on the Education_level column. I want to be able to guess the Income_category for NA's using the Educational level column, but the problem is Income_category column contains symbols and other values which prevent me from applying median imputation on it. Any help to solve this problem would be really helpful.
Sample code:
med_uned_inc<-median(ref_data[ref_data$Education_Level == 'Uneducated','Income_Category'],na.rm = TRUE)
Sample data:
Customer_Age Gender Dependent_count Education_Level Marital_Status Income_Category Card_Category
1 45 M 3 High School Married $60K - $80K Blue
2 49 F 5 Graduate Single Less than $40K Blue
3 51 M 3 Graduate Married $80K - $120K Blue
5 40 M 3 Uneducated Married $60K - $80K Blue
6 44 M 2 Graduate Married $40K - $60K Blue
7 51 M 4 <NA> Married $120K + Gold
9 37 M 3 Uneducated Single $60K - $80K Blue
10 48 M 2 Graduate Single $80K - $120K Blue
12 65 M 1 <NA> Married $40K - $60K Blue
13 56 M 1 College Single $80K - $120K Blue
15 57 F 2 Graduate Married Less than $40K Blue
17 48 M 4 Post-Graduate Single $80K - $120K Blue
18 41 M 3 <NA> Married $80K - $120K Blue
19 61 M 1 High School Married $40K - $60K Blue
20 45 F 2 Graduate Married <NA> Blue
21 47 M 1 Doctorate Divorced $60K - $80K Blue
22 62 F 0 Graduate Married Less than $40K Blue
23 41 M 3 High School Married $40K - $60K Blue
24 47 F 4 <NA> Single Less than $40K Blue
25 54 M 2 <NA> Married $80K - $120K Blue