0

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.

  • 3
    It's easier to help you if you provide a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Please [do not post code or data in images](https://meta.stackoverflow.com/q/285551/2372064) – MrFlick Aug 08 '22 at 14:06
  • Thank you so much MrFlick, i will tray to post the reproducible example – Mohamed Ibrahim Aug 08 '22 at 15:10

0 Answers0