This was probably asked before, but i haven't found an answer to my problem.
I have a dataframe similar to this:
id col1 col2 col3 col4
1 111111 car <NA> NA NA
2 111111 <NA> bike NA NA
3 111111 <NA> <NA> 2 NA
4 111111 <NA> <NA> NA 3
5 222222 plane <NA> NA NA
6 222222 <NA> train NA NA
7 222222 <NA> <NA> 4 NA
8 222222 <NA> <NA> NA 5
How can I aggregate by id
to get a dataframe similar to this one:
id col1 col2 col3 col4
1 111111 car bike 2 3
2 222222 plane train 4 5