I have two lists (Phase and Rate in the example). What I need to do is to create a new list with two nested lists where the elements of the second one (Rate) are grouped by the levels of the first one (Phase). It might be a very basic question but I could not come up with a solution.
Phase <- c("A", "A", "A", "A", "B", "B", "B")
Rate <- c(1, 2, 3, 2, 6, 2, 9)
list(A = c(1, 2, 3, 2), B = c(6, 2, 9))
Thanks for any help!