I have a big table 5000 by 2000 with the values provided below.
I need to get rid of columns with identical names while keeping the maximum for every position in a column (for all duplicates).

I am stuck.. I have a similar code for removing duplicates by rownames

```
x <- setDT(x)[, lapply(.SD, max), cName]

```

but I don't know how to do the same trick but by column

```
prot1   prot1   prot1   prot2   prot3
0.889618286 0.907433399 0.085730039 0.010259207 0.01203583
0.766053072 0.061778787 0.193634896 0.387856898 0.029151237
0.399227213 0.980691544 0.30179994  0.768697098 0.749744349
0.089657475 0.353170832 0.85146464  0.580683125 0.606756472
0.341599883 0.790159839 0.653031942 0.011711575 0.569486433
0.627587607 0.363081942 0.628312001 0.137380824 0.535160381

```

so the cleaned version is 

```
prot1   prot2   prot3
0.907433399 0.010259207 0.01203583
0.766053072 0.387856898 0.029151237
0.980691544 0.768697098 0.749744349
0.85146464  0.580683125 0.606756472
0.790159839 0.011711575 0.569486433
0.628312001 0.137380824 0.535160381

```