Exclude columns with no variance [duplicate]
问题 This question already has answers here : Quickly remove zero variance variables from a data.frame (8 answers) Closed 3 years ago . How to exclude from data matrix of nearly 1,000 variables the variables/columns with variance equal to 0 (zero) (i.e. all the cases/observations in the variable/column have the same value)? I can imagine calculate variances for each column and then manually write the numbers of columns to be excluded (or included as this seems to be easier to do in R). But sure