Description Usage Arguments Details Value Examples
Binarize multiple columns of a dataframe based on a given threshold.
binarizer is designed to work with %>% pipelines.
binarizer_ is a standard evalution version.
1 2 3 |
data |
Dataframe, tbl, vector |
..., cols |
Variables to include/exclude. ... : You can use same specifications as in dplyr's select. cols : character vector If missing, defaults to all non-grouping variables. |
thresh |
Threshold (Numeric). |
Binarizes each specified column and converts to tibble.
Tibble where selected columns have been binarized.
Above thresh is 1; below or equal to thresh is 0.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Attach package
library(LRO.utilities)
# Create dataframe
df <- data.frame('a' = c(1,2,3,4,5,6,7),
'b' = c(2,3,4,5,6,7,8))
# First center both columns
centered_df <- scaler(df, scale = FALSE)
# Binarizing multiple columns
binarizer(centered_df)
binarizer(centered_df, a, b)
binarizer(centered_df, 1:2)
binarizer(centered_df, c(a,b))
# Binarize 'a'
binarizer(centered_df, a)
# Binarize all but 'a'
binarizer(centered_df, -a)
## Standard evalutation versions
binarizer_(centered_df, cols = c('b'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.