Feature/select optgroup (closes #520)

This is built on @yihui's pull request #520, but with two main changes:

* `choicesWithNames` always converts `choices` to a named list, which simplifies a lot of other code.
* There are tests which exercise some corner cases.

The update*Input code still needs some work at this point.