I've a data in the following format
Id Duration Name
(Numeric) (Factor) (Factor)
1 2 x
1 3 y
1 1 z
2 1 x
2 2 x
I want to iterate over the 'id' field and for each unique id, I need to create an array from 'Name' field of the form (x,y,z) {the order is important}.
The expected output would look something like a map
1 : (x,y,z)
2 : (x,x)
I'm using a nested for loop to iterate over the length of the unique(Id) but i feel i'm defeating the purpose of using R.
I feel a little rusty with my understanding of the apply family of functions and although i looked at this and specifically this but the challenge in using lapply also is the difference in data types of the columns.
Do let me know if someone can suggest a better alternative than using for loop.
Thanks in advance.