How to convert choices to groups