I have a dataset1 which is as follows:
dataset1 <- data.frame(  
   id1 = c(1, 1, 1, 2, 2, 2),    
   id2 = c(122, 122, 122, 133, 133, 133),  
   num1 = c(1, NA, NA, 50,NA, NA),  
   num2 = c(NA, 2, NA, NA, 45, NA),  
   num3 = c(NA, NA, 3, NA, NA, 4)  
 )
How to convert multiple rows into a single row?
The desired output is:
id1, id2, num1, num2, num3   
1    122   1     2      3      
2    133   50    45     4  
 
     
     
     
    
