Skip to contents

Column maker

Usage

col_maker(col_types, size, missing, ...)

Arguments

col_types

column type

size

how many rows?

missing

logical, include missing?

...

additional arguments passed to _maker functions

Examples

col_maker(col_types = c("log", "log", "dbl", "dbl", "fct", "ord", "chr"),
  size = 6, missing = FALSE)
#> # A tibble: 6 × 7
#>   log_var log_2_var dbl_var dbl_2_var fct_var ord_var chr_var
#>   <lgl>   <lgl>       <dbl>     <dbl> <fct>   <ord>   <chr>  
#> 1 TRUE    TRUE         0.1       0.1  group 1 level 1 item:1 
#> 2 FALSE   FALSE        0.68      0.68 group 2 level 2 item:2 
#> 3 TRUE    TRUE         1.26      1.26 group 3 level 3 item:3 
#> 4 FALSE   FALSE        1.84      1.84 group 1 level 1 item:1 
#> 5 TRUE    TRUE         2.42      2.42 group 2 level 2 item:2 
#> 6 FALSE   FALSE        3         3    group 3 level 3 item:3 
col_maker(col_types = c("log", "log", "dbl", "dbl", "fct", "ord", "chr"),
  size = 10, missing = TRUE, lvls = 4)
#> # A tibble: 10 × 7
#>    log_var log_2_var dbl_var dbl_2_var fct_var ord_var chr_var
#>    <lgl>   <lgl>       <dbl>     <dbl> <fct>   <ord>   <chr>  
#>  1 TRUE    TRUE         0.1       0.1  group 1 level 1 item:1 
#>  2 FALSE   FALSE        2.55      2.55 group 2 level 2 item:2 
#>  3 NA      NA           5         5    group 3 level 3 item:3 
#>  4 TRUE    TRUE        NA        NA    group 4 level 4 item:4 
#>  5 FALSE   FALSE        0.1       0.1  NA      NA      NA     
#>  6 NA      NA           2.55      2.55 group 1 level 1 item:1 
#>  7 TRUE    TRUE         5         5    group 2 level 2 item:2 
#>  8 FALSE   FALSE       NA        NA    group 3 level 3 item:3 
#>  9 NA      NA           0.1       0.1  group 4 level 4 item:4 
#> 10 TRUE    TRUE         2.55      2.55 NA      NA      item:1 
col_maker(col_types = c("log", "log", "dbl", "dbl", "fct", "ord", "chr"),
  size = 10, missing = TRUE, lvls = 2)
#> # A tibble: 10 × 7
#>    log_var log_2_var dbl_var dbl_2_var fct_var ord_var chr_var
#>    <lgl>   <lgl>       <dbl>     <dbl> <fct>   <ord>   <chr>  
#>  1 TRUE    TRUE         0.1       0.1  group 1 level 1 item:1 
#>  2 FALSE   FALSE        2.55      2.55 group 2 level 2 item:2 
#>  3 NA      NA           5         5    NA      NA      NA     
#>  4 TRUE    TRUE        NA        NA    group 1 level 1 item:1 
#>  5 FALSE   FALSE        0.1       0.1  group 2 level 2 item:2 
#>  6 NA      NA           2.55      2.55 NA      NA      NA     
#>  7 TRUE    TRUE         5         5    group 1 level 1 item:1 
#>  8 FALSE   FALSE       NA        NA    group 2 level 2 item:2 
#>  9 NA      NA           0.1       0.1  NA      NA      NA     
#> 10 TRUE    TRUE         2.55      2.55 group 1 level 1 item:1 
col_maker(col_types = c("log", "log", "dbl", "dbl", "fct", "ord", "chr"),
  size = 6, missing = FALSE)
#> # A tibble: 6 × 7
#>   log_var log_2_var dbl_var dbl_2_var fct_var ord_var chr_var
#>   <lgl>   <lgl>       <dbl>     <dbl> <fct>   <ord>   <chr>  
#> 1 TRUE    TRUE         0.1       0.1  group 1 level 1 item:1 
#> 2 FALSE   FALSE        0.68      0.68 group 2 level 2 item:2 
#> 3 TRUE    TRUE         1.26      1.26 group 3 level 3 item:3 
#> 4 FALSE   FALSE        1.84      1.84 group 1 level 1 item:1 
#> 5 TRUE    TRUE         2.42      2.42 group 2 level 2 item:2 
#> 6 FALSE   FALSE        3         3    group 3 level 3 item:3