I've got a dataframe structured like this:
df = data.frame(topic = c("xxx", "xxx", "yyy", "yyy", "yyy", "zzz", "zzz"),
high = c(52L, 27L, 89L, 99L, 43L, 21L, 90L),
low = c(56L, 98L, 101L, 21L, 98L, 40L, 43L),
stringsAsFactors = FALSE)
I would like to create a single variable for each unique value in the topic column, while keeping all the observations untouched. Basically it's like looping this dplyr filter:
zzz = df %>% filter (topic == "zzz")
It should be easy, so I'm sure I'm missing some basic knowledge here... Thanks!
Edit: It was my first question on stackoverflow, I apologize for the bad formatting.