I have a tibble and in one of the columns are strings. They are names of instruments that respondents to a survey said they played. I would like to capture each instrument as it's own separate string. Values in this column range from one single string like guitar, to more complex answers: Sing, Drums/Percussion, Piano/Keyboard... etc I have tried something like this:
options <- strsplit(survey$instruments_list, "\\, | \\/ | ")
unfortunately the output still has the / character between several strings.
also as a final problem, one of the respondents answered with an incredibly long winded answer separated by multiple spaces and I just want the instrument, not their life story.
any suggestions will be greatly appreciated, thank you! edit: results of dput(head(survey))
structure(list(time_submitted = c("8/27/19 20:22", "8/29/19 12:15",
"8/28/19 19:33", "8/29/19 16:25", "8/27/19 15:40", "8/27/19 22:59"
), pseudonym_generator = c("Fake rapper name generator", "Fake band name generator",
"Fake band name generator", "Fake band name generator", "Fake band name generator",
"Fake band name generator"), pseudonym = c("Lord Los Angeles",
"Heroes War", "Puppets War", "West Magic", "Eller Angel", "Trace Stripes"
), sex = c("Male", "Male", "Male", "Male", "Male", "Male"), academic_major = c("Computer Science",
"Computer Science", "Math", "Computer Science", "Computer Science",
"Computer Science"), academic_level = c("Senior", "Junior", "Senior",
"Junior", "Senior", "Senior"), year_born = c(1994, 1997, 1996,
1999, 1998, 1986), instrument_list = c("Rap", "Guitar", "Guitar",
"Trumpet", "Piano/Keyboards, Ukulele", NA), favorite_song_artist = c("40 crew",
"Arctic Monkeys", "Avatar", "Ben Folds", "blink-182", "brian jonestown massacre / sarabeth tucek"
), favorite_song = c("Not Enough", "Arabella", "The Eagle Has Landed",
"Still", "She's Out Of Her Mind", "Seer"), favorite_song_link = c("https://www.youtube.com/watch?v=uITuGZKljgQ",
"https://www.youtube.com/watch?v=Jn6-TItCazo", "https://www.youtube.com/watch?v=4p6GWewmTYQ",
"https://www.youtube.com/watch?v=ShBzUK4rnI8", "https://www.youtube.com/watch?v=krpm0v_486k",
"https://youtu.be/C-XT7DZsNP8")), class = c("tbl_df", "tbl",
"data.frame"), row.names = c(NA, -6L))