1

In R I have a table with columns:

 $ minEDGE     : num  55 13 37 22 40 34 65 37 62 45 
 $ diagonalEDGE: num  401 506 520 591 529 526 607 715 607 713 
 $ maxECC      : num  100 100 100 100 100 100 100 100 100 100 

I want to delete the column which consists of one specific value only (e.g. 100 in column maxECC)

Result should be:

$ minEDGE     : num  55 13 37 22 40 34 65 37 62 45 
$ diagonalEDGE: num  401 506 520 591 529 526 607 715 607 713 

It would also be interesting for non-integer values (e.g. chars or strings), which can't be solved by calculating the variance.

mrk
  • 8,059
  • 3
  • 56
  • 78

1 Answers1

3

We can use Filter

Filter(var, df1)

Or

Filter(function(x) length(unique(x))==1, df1)
akrun
  • 874,273
  • 37
  • 540
  • 662