I have typical survey style data in R. Multiple columns with binary -- yes/no -- records. I'm looking to create a single, categorical column based on those columns.
We'll call the dataframe schools
PreK Kindergarten First Second Third Fourth ...
1 yes yes no no no no
2 no no yes yes yes yes
I'd like the new column to look like this
... Grades
1 prek, kg
2 elementary
I thought it might need to have to be a lot of nested ifelse strings. It goes up to 14 columns, and the new "grades" column will need to be diverse enough to address any combination of grades (e.g. 6 - 12).
I'm trying to create a new column based on the values of already existing columns. Those existing columns are all YES and NO (like checkmarks). I want the new column to reflect categories that bin together the YES values. Say, one row has YES in the "ninth", "tenth", "eleventh" and "twelfth" column, I want that to translate into "high school" in the new column.