cat2cat_agg {cat2cat}R Documentation

Aggregate panel dataset - Manual mapping of a categorical variable according to a new encoding

Description

Aggregate dataset - Manual mapping of a categorical variable according to a new encoding where user supplying transitions by equations.

Usage

cat2cat_agg(
  data = list(old = NULL, new = NULL, cat_var = NULL, time_var = NULL, freq_var = NULL),
  ...
)

Arguments

data

list with 5 named fields 'old' 'new' 'cat_var' 'time_var' 'freq_var'

...

equations

Details

data args

... equations where direction is set by ">","<","

Value

list of data.frame objects

Examples

data(verticals)
agg_old <- verticals[verticals$v_date == "2020-04-01", ]
agg_new <- verticals[verticals$v_date == "2020-05-01", ]

## cat2cat_man - could map in both directions at once although
## usually we want to have oold or new representation

agg = cat2cat_agg(data = list(old = agg_old,
                             new = agg_new,
                             cat_var = "vertical",
                             time_var = "v_date",
                             freq_var = "counts"),
                 Automotive %<% c(Automotive1, Automotive2),
                 c(Kids1, Kids2) %>% c(Kids),
                 Home %>% c(Home, Supermarket))

[Package cat2cat version 0.2.1 Index]