alternative | R Documentation |
The 'alternative' R6 class serves to define alternatives to be included into choice sets. The object stores information about the available attributes and their possible values. The values may be specified as vectors using 'c()' function or as random declaration using statistical functions of 'r' type. The object is initialized without attributes and should be later populated with them.
attributes
A list of attributes definitions
add_attributes()
Append a list of 'call' attributes definitions to the attributes.
alternative$add_attributes(...)
...
The attributes should have a name and generation procedure defined (ex: 'Quality = c(0:1)')
get_attributes()
Get a vector of available attributes' names
alternative$get_attributes()
Character vector with unique attributes names.
get_laws()
Get a list of alternatives' generation rules
alternative$get_laws()
Get a list of laws associated to alternative's attributes.
clone()
The objects of this class are cloneable with this method.
alternative$clone(deep = FALSE)
deep
Whether to make a deep clone.
alt <- alternative$new() alt$add_attributes(Quality = c(0, 1), Price = rnorm(mean = 5)) alt$get_attributes() alt$get_laws()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.