I have a dataset with information along these lines:
d <- data.frame(
ID = c(1,2,3,4),
Baseball = c(1,0,0,0),
Basketball = c(1,0,1,0),
Lacross = c(0,1,0,0),
Hockey = c(1,0,0,0),
Football = c(0,0,1,0)
)
Where 1 indicated that the person does the sport and 0 indicated they do not.
Now I want to create a new column that takes into account the sport season and apprehends them together (in this, Spring= baseball, lacrosse, Fall = football, Winter= basketball, hockey)
What I would want is an output something like:
ID Baseball Basketball Lacross Hockey Football Season
1 1 1 0 1 0 Spring, Winter
2 0 0 1 0 0 Spring
3 0 1 0 0 1 Winter, Fall
4 0 0 0 0 0 NA
Where I do not want duplicates if they play multiple sports in the same season like "Spring, Winter, Winter". Preferably if they could all be in the same order (all Spring, Winters are in that order), that would be great, but I can also edit that later.