Makes sure the factor levels in data_new are aligned with data_old This is helpful for demand simulations.

prep_newprediction(data_new, data_old)

Arguments

data_new

New long-format choice data

data_old

Old long-format choice data

Value

long-format choice data

Examples

data(icecream)
prep_newprediction(icecream, icecream)
#> # A tibble: 39,600 × 8
#>       id  task   alt     x     p Brand     Flavor      Size 
#>    <int> <int> <int> <dbl> <dbl> <fct>     <fct>       <ord>
#>  1     1     1     1     8 0.998 Store     Neapolitan  16   
#>  2     1     1     2     0 0.748 Store     VanillaBean 16   
#>  3     1     1     3     0 1.25  BenNJerry Oreo        16   
#>  4     1     1     4     0 0.748 BenNJerry Neapolitan  16   
#>  5     1     1     5     0 2.49  HaagenDa  RockyRoad   4    
#>  6     1     1     6     0 1.25  HaagenDa  Oreo        16   
#>  7     1     1     7     0 1.12  BlueBunny Oreo        16   
#>  8     1     1     8     0 1.99  BlueBunny Neapolitan  4    
#>  9     1     1     9     0 0.622 Breyers   RockyRoad   16   
#> 10     1     1    10     0 3.49  Breyers   Vanilla     4    
#> # … with 39,590 more rows