Fix edge case with nested choices. Fixes #560

When the set of choices is a list containing a named vector of length 1,
choicesWithNames would return the wrong result.
This commit is contained in:
Winston Chang
2014-08-01 16:11:51 -05:00
parent 3aa22127e0
commit 21fb7959a5
2 changed files with 6 additions and 1 deletions

View File

@@ -681,7 +681,7 @@ choicesWithNames <- function(choices) {
res <- lapply(obj, function(val) {
if (is.list(val))
listify(val)
else if (length(val) == 1)
else if (length(val) == 1 && is.null(names(val)))
val
else
makeNamed(as.list(val))