I am trying to combine multiple columns in R into a single one.
My data looks like this:
age gender a b c d e f race insured
1 13 Female 0 0 0 0 0 0 white 0
2 12 Female 0 0 0 0 0 0 white 1
3 19 Male 0 0 0 0 0 1 other 0
4 19 Female 0 1 0 0 0 0 white 0
5 13 Female 1 1 0 0 0 1 white 0
This is what my desired output looks like:
age gender race insured value
1 13 Female white 0 none
2 12 Female white 1 none
3 19 Male other 0 f
4 19 Female white 0 b
5 13 Female white 0 a
5 13 Female white 0 b
5 13 Female white 0 f
I've tried using gather to create a long data frame but this doesn't add the data to the dataframe like i want. How can I do this with the dplyr or tidyverse package?