| find_binary_cols | R Documentation |
Identifies columns in a data.frame or data.table that are binary (i.e., contain only two unique values), optionally including logical columns.
find_binary_cols(x, include_logical = FALSE)
x |
A data.frame or data.table to search for binary columns. |
include_logical |
Logical. If TRUE, logical columns are also considered binary. Default is FALSE. |
A character vector of column names that are binary, or NULL if none are found.
df <- data.frame(a = c(0, 1, 1), b = c(TRUE, FALSE, TRUE), c = c(1, 2, 3))
find_binary_cols(df)
find_binary_cols(df, include_logical = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.