I'm trying to separate out free text fields until individual words/phrases, while also keeping their association with a group so I can stratify in my graphing later on
here is my original code. I'm trying to add in a "year" variable so I can stratify the different research interests by what year a student is in. I'd like to have a total n for each word, as well as n for each year
example of my data set:
Please.list.your.research.interests | Year |
---|---|
Vaccines, TB, HIV | 1st year |
TB, Chronic Diseases | 2nd year |
library(tidyverse)
library(tidytext)
data_research_words <- unlist(strsplit(data_research$Please.list.your.research.interests, ", "))
text_df <- tibble(line=1:97, data_research_words)
text_count <- text_df %>%
count(data_research_words, sort=TRUE)
Something like this?
Output: