Skip to contents

brand_add_attributes() stores raw long attribute ratings, keeps their original response values untouched, and adds attribute_col directly to the stored attribute data for later scoring and modeling.

Usage

brand_add_attributes(
  brand,
  attribute_data,
  set_name = "default",
  verbose = TRUE
)

Arguments

brand

A g6tr_brand object created with brand_create().

attribute_data

A data frame containing response_id, brand, attribute, and response.

set_name

Name of the attribute set to store. Defaults to "default".

verbose

If TRUE, print informative messages and warnings.

Value

An updated g6tr_brand object.

Examples

brand <- brand_create(
  respondents = c("1001", "1002"),
  brands = factor(c("Nike", "Adidas"), levels = c("Nike", "Adidas"))
)
#> ✔ Created brand analysis object: 2 respondents x 2 brands = 4 panel rows.

attributes <- dplyr::tibble(
  response_id = c("1001", "1001", "1002", "1002"),
  brand = c("Nike", "Adidas", "Nike", "Adidas"),
  attribute = c("Style", "Style", "Style", "Style"),
  response = factor(
    c("Good", "Poor", "Excellent", "Good"),
    levels = c("Poor", "Good", "Excellent")
  )
)

brand <- brand_add_attributes(
  brand = brand,
  attribute_data = attributes
)
#> ✔ Attributes [default] supplied 4 rows (1 attributes x 2 respondents x 2 brands).
#> ✔ [default] all 2 brands have all 1 attributes.
#> ℹ Summary by attribute [default]
#>   • Style: 4 rows (2 respondents x 2 brands)