I might be using it wrong, but when I use the code below it only prints out a summary statement. Is there a way to save this output in a new variable?
data %>%
mutate(motivation = case_when(DRG_WHY_TRY == 1 ~ 'experimentation'
,DRG_WHY_SLP == 1 ~ 'cope'
,DRG_WHY_RLX == 1 ~ 'cope'
,DRG_WHY_PAN == 1 ~ 'medical'
,DRG_WHY_NTH == 1 ~ 'bored'
,DRG_WHY_NCN == 1 ~ 'no conseq'
,DRG_WHY_MED == 1 ~ 'medical'
,DRG_WHY_HIG == 1 ~ 'enhancement'
,DRG_WHY_FUN == 1 ~ 'social'
,DRG_WHY_FRD == 1 ~ 'conformity'
,DRG_WHY_FGT == 1 ~ 'cope'
,DRG_WHY_FEL == 1 ~ 'enhancement'
,DRG_WHY_ANX == 1 ~ 'cope'
,TRUE ~ 'else'))