I have collected data on social media usage by using Google form. Multiple choice question were stacked in one column, which I need to split into multiple columns. But some variables were mixed with the main variable. For example a twitter column may include others social media, instead I aim only to find out twitter in the column.
Given below is my code:
split <- social %>%
separate(typeSocial, into = c("useFacebok", "useTwitter", "useYoutube", "uselinkedin", "useTiktok", "useSnapchat", "useInstagram"), sep = ",", extra = "drop", fill = "right")
You can check my output rpubs. I have solved this problem in excel, but right now, I wish clean this data on R, because I know how much time consumed this problem. I would like to get help from the community.
I wish to thank MrFlick who proposed to make my code reproducible.