I'll explain what my issue is here. Here's what I have.
Column of Individual strings
df <- as.data.frame(c("NI",
"FA",
"FI",
"FST",
"FA,NI",
"IA,FI,IO",
"NI,DI",
"IA,NI,IO",
"IA,FT,FI",
"FA,FT,FI",
"IA,FST,FI"))
names(df) <- "Column_of_strings"
NOTE: output may not show with quotes, but they are strings. I decided to include them in for the heck of it.
df
Column_of_strings
"NI"
"FA"
"FI"
"FST"
"FA,NI"
"IA,FI,IO"
"NI,DI"
"IA,NI,IO"
"IA,FT,FI"
"FA,FT,FI"
"IA,FST,FI"
What I would like:
Column_of_strings
"NI"
"FA"
"FI"
"FST"
"FA","NI"
"IA","FI","IO"
"NI","DI"
"IA","NI","IO"
"IA","FT","FI"
"FA","FT","FI"
"IA","FST","FI"
or even better would be if it these groups of strings could be stored as vectors themselves.
Column_of_strings
c("NI")
c("FA")
c("FI")
c("FST")
c("FA","NI")
c("IA","FI","IO")
c("NI","DI")
c("IA","NI","IO")
c("IA","FT","FI")
c("FA","FT","FI")
c("IA","FST","FI")
In summary:
Does anyone have an idea of how to:
- Initially unpack the list of strings I have
- Assign subgroups of strings within each string, commas separate each desired string.
- Assign subgroups to a vector ideally
All advice appreciated!