price_prep | R Documentation |
This function helps users efficiently rename their variables as prices. At the same time, it will return only the variables required for purchase task processing: the unique identifier and the purchase task variables themselves.
price_prep(pt, id_var, vars, prices)
pt |
A data frame which includes the 'id_var' and purchase task variables. |
id_var |
The name of the unique identifier (ID) as identified in the data frame. |
vars |
The variable names of the purchase task items. |
prices |
The prices associated with each purchase task item in the same order as the 'vars'. |
A data frame consisting of variables 'vars' renamed as 'prices', as well as 'id_var'.
### --- Load Data
data("cpt_data")
### --- Function Example
pt <- price_prep(cpt_data, id_var = "ID", vars = c(paste0("cpt",1:15)),
prices = c("0","0.05","0.10","0.20","0.30","0.40","0.50","0.75","1","2","3","4","5","7.5","10"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.