anim_prep {animbook} | R Documentation |
Transformed numerical into categorized data
Description
This function transformed the numerical data into the categorized format by grouping data and scaling values.
Usage
anim_prep(
data,
id = NULL,
values = NULL,
time = NULL,
group = NULL,
ncat = 5L,
breaks = NULL,
label = NULL,
group_scaling = NULL,
scaling = "rank"
)
Arguments
data |
A data frame contained the numerical values. |
id |
The column name that represents the identifiers variable. |
values |
The column name contains the numeric values. |
time |
The column name that represents the time variable. |
group |
The column name that represents the distinguished group between the values. |
ncat |
The number of categories to be created for scaling values. |
breaks |
A vector of breaks for creating bins. |
label |
A vector of labels to represent the qtile. |
group_scaling |
The column name that will be used for grouping the variable before scaling. |
scaling |
The scaling method to be used; "rank" or "absolute". |
Details
The function takes the input data and performs several operations to transformed it into categorized format. It is done by grouping data, scales values, and assigned the qtile.
Value
A categorized data.
Examples
# rank scaling
anim_prep(data = osiris, id = ID, values = sales, time = year)
# group_rank scaling
anim_prep(data = osiris, id = ID, values = sales, time = year,
group_scaling = country)
# absolute scaling
anim_prep(data = osiris, id = ID, values = sales, time = year,
scaling = "absolute")
# group_absolute scaling
anim_prep(data = osiris, id = ID, values = sales, time = year,
group_scaling = country, scaling = "absolute")