Skip to contents

This function transformed the category data in the categorized format by ordering the values.

Usage

anim_prep_cat(
  data,
  id = NULL,
  values = NULL,
  time = NULL,
  group = NULL,
  order = NULL,
  label = NULL
)

Arguments

data

A data frame contained the category values.

id

The column name that represents the identifiers variable.

values

The column name contains the category values.

time

The column name that represents the time variable.

group

The column name that represents the distinguished group between the values.

order

A vector of order for sorting the category values.

label

A vector of labels to represent the qtile.

Value

A categorized data.

Details

The function takes the input data, ordering the values, and assigning the variable names.

Examples

anim_prep_cat(data = aeles, id = id, values = party, time = year)
#> # A tibble: 1,468 × 4
#>    id         time qtile label   
#>    <fct>     <int> <dbl> <chr>   
#>  1 219810001  2019     5 labor   
#>  2 219810001  2016     6 liberal 
#>  3 219810003  2019     5 labor   
#>  4 219810003  2016     5 labor   
#>  5 219810004  2019     6 liberal 
#>  6 219810004  2016     2 national
#>  7 219810005  2019     5 labor   
#>  8 219810005  2016     5 labor   
#>  9 219810007  2019     4 greens  
#> 10 219810007  2016     4 greens  
#> # ℹ 1,458 more rows