note: for non-binary data, all values other than the true_level will be set to false

# S3 method for data.frame
set_lgl(.data, ..., true_level = 1L)

set_lgl(.data, ..., true_level = 1L)

# S3 method for default
set_lgl(.data, ...)

# S3 method for numeric
set_lgl(.data, ..., true_level = 1L)

# S3 method for character
set_lgl(.data, ..., true_level = c("T", "TRUE"))

Arguments

.data

dataframe

...

tidyselect. Default selection: none

true_level

specify the value to set as TRUE. Default value is 1 for seamless conversion between logicals and integers. Can be given as a vector of values.

Value

dataframe

Examples


# convert a 1/0 vector back into T/F

tibble::tibble(x = c(1, 0, 0, 1, 0, 1)) %>%
set_lgl(x)
#> # A tibble: 6 × 1
#>   x    
#>   <lgl>
#> 1 TRUE 
#> 2 FALSE
#> 3 FALSE
#> 4 TRUE 
#> 5 FALSE
#> 6 TRUE