# NOT RUN {
# Example without continuous attributes.
l <- c(3, 4, 2) # 3 Attributes.
c <- c("D", "E", "D") # Coding.
# All profiles.
p <- Profiles(lvls = l, coding = c)
cs <- p[c(4, 8), ] # Choice set
# Levels as they should appear in survey.
al <- list(
c("$50", "$75", "$100"), # Levels attribute 1.
c("2 min", "15 min", "30 min", "50 min"), # Levels attribute 2.
c("bad", "good") # Levels attribute 3.
)
# Decode
Decode(set = cs, lvl.names = al, coding = c, alt.cte = c(0, 0))
# Example with continuous attribute.
l <- c(3, 4, 2) # 3 Attributes.
c <- c("D", "C", "D") # Coding.
cl <- list(c(50, 75, 80, 100))
# All profiles.
p <- Profiles(lvls = l, coding = c, c.lvls = cl)
cs <- p[c(4, 8), ] # Set.
a <- c(1, 0) # Alternative specific constant.
cs <- cbind(a, cs) # set with alt.cte
# Levels as they should appear in survey.
al <- list(
c("$50", "$75", "$100"), # Levels attribute 1.
c("50 min", "75 min", "80 min", "100 min"), # Levels attribute 2.
c("bad", "good") # Levels attribute 3.
)
# Decode
Decode(set = cs, lvl.names = al, coding = c, alt.cte = c(1, 0), c.lvls = cl)
# }
Run the code above in your browser using DataLab