Produce a dataframe to summarise ticked variables
ticked_table.Rd
Takes a dataframe and produces the number and percentage for ticked variables.
Arguments
- df
Data Frame
- ...
Variables to be summarised
- group
Optional variable that defines the grouping
- sep
Optional separator between columns for splitting variable into variable and scoring. See ?tidyr::separate for more information.
- digits
Number of digits to the right of the decimal point
- total
Logical indicating whether a total column should be created
- condense
condense = TRUE
is deprecated, usecondense()
instead.
Examples
ticked_table(outcome, pet_cat, pet_dog, group = group, sep = "_")
#> # A tibble: 3 × 5
#> variable scoring A B Total
#> <chr> <chr> <chr> <chr> <chr>
#> 1 NA NA N = 276 N = 324 N = 600
#> 2 pet cat 48 (17.4%) 75 (23.1%) 123 (20.5%)
#> 3 pet dog 96 (34.8%) 105 (32.4%) 201 (33.5%)
ticked_table(outcome, pet_fish, pet_dog)
#> # A tibble: 3 × 2
#> scoring value
#> <chr> <chr>
#> 1 NA N = 600
#> 2 pet_fish 99 (16.5%)
#> 3 pet_dog 201 (33.5%)