I have a function in my real-world problem that returns a list. Is there any way to use this with the dplyr mutate()? This toy example doesn\'t work -:
it =
The mutate() function is designed to add new columns to the existing data frame. A data frame is a list of vectors of the same length. Thus, you cant add a list as a new column, because a list is not a vector.
You can rewrite your function as two functions, each of which return a vector. Then apply each of these separately using mutate() and it should work.