df <- data.frame(a = c(1, 2, 3, 4, 5), b = c(2, 3, 5, 6, 3), c = c(1, 2, 3, 4, 5), d = c(2, 3, 4, 4, 4), e = c(2, 3, 5, 6, 3))  
  a b c d e
  1 2 1 2 2
  2 3 2 3 3
  3 5 3 4 5
  4 6 4 4 6
  5 3 5 4 3 
My question is rather simple, but I cannot get around it myself. Is there a simple way to remove all the duplicated columns except one (in each 'group', i.e. in this case we have groups of (a, c) and (b, e))?
My expected output:
  a b d
  1 2 2
  2 3 3
  3 5 4
  4 6 4
  5 3 4
Since due to a specific situation I cannot turn the dataframe into a matrix, this has to apply to a dataframe, possibly to a dataframe of larger volume.
 
     
    