I’m R-beginner, I assume this is not so difficult. I want to combine values of a data.frame, like this:
Input data.frame:
col1 col2
1 a 50
2 a 80
3 b 40
4 c 20
Output data.frame:
col1 col1
1 a [50,80]
2 b [40]
3 c [20]
In the input, col1 is not unique. For each value in col1, I want to combine all values in col2 in a vector. In the output, col1 is unique.
Can you help me with this?
Entries of a data-frame cannot be lists, they must be atomic. What you probably want is to get a named list of vectors:
which is a named list: