Last active
August 29, 2015 14:16
-
-
Save briandconnelly/f49c0e4d7ae11ed62fb5 to your computer and use it in GitHub Desktop.
Get the names of columns that have >1 unique values in an R data frame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
what_varies <- function(d) | |
{ | |
varies <- function(x) nrow(unique(d[x])) > 1 | |
return(names(d)[unlist(lapply(seq_len(ncol(d)), varies))]) | |
} |
hadley
commented
Mar 5, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment