Skip to contents

Easily subset by data type function

Usage

subset_types(data, types, type.fun = outcome_type)

Arguments

data

data

types

desired types

type.fun

function to get type. Default is outcome_type

Value

vector

Examples

default_parsing(mtcars) |> subset_types("ordinal")
#> # A tibble: 32 × 3
#>    cyl   gear  carb 
#>    <fct> <fct> <fct>
#>  1 6     4     4    
#>  2 6     4     4    
#>  3 4     4     1    
#>  4 6     3     1    
#>  5 8     3     2    
#>  6 6     3     1    
#>  7 8     3     4    
#>  8 4     4     2    
#>  9 4     4     2    
#> 10 6     4     4    
#> # ℹ 22 more rows
default_parsing(mtcars) |> subset_types(c("dichotomous", "ordinal"))
#> # A tibble: 32 × 5
#>    cyl   vs    am    gear  carb 
#>    <fct> <lgl> <lgl> <fct> <fct>
#>  1 6     FALSE TRUE  4     4    
#>  2 6     FALSE TRUE  4     4    
#>  3 4     TRUE  TRUE  4     1    
#>  4 6     TRUE  FALSE 3     1    
#>  5 8     FALSE FALSE 3     2    
#>  6 6     TRUE  FALSE 3     1    
#>  7 8     FALSE FALSE 3     4    
#>  8 4     TRUE  FALSE 4     2    
#>  9 4     TRUE  FALSE 4     2    
#> 10 6     TRUE  FALSE 4     4    
#> # ℹ 22 more rows
#' default_parsing(mtcars) |> subset_types("factor",class)