I have a df called "homes", it has two columns: "Education level" and "Insurance". Ed level is a categoric variable has four leves: Primary, High-Sch, Terciary and College. For instance:
Ed.Level. Insurance
Primary. YES
Primary. NO
Primary. NO
College. YES
College. YES
High-Sch. YES
High-Sch. NO
Terc. YES
I need to create a new column with name: Primary with values: YES, NO, etc. and the same logic for each education level. The expected output would be:
Primary. Secondary High Sch College
YES. NO. YES. NO
NO. YES. NO. YES
YES. YES YES. NO
NO. YES YES. YES
The values in the expected output are refered to the Insurance field.
I tried with a transpose and didn't work, cbind, merges, but nothing worked. How can I do that? Thanks.