I want to create a select options like this below,
<select id="species">
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
</select>
So I use data frame to create a table that stores the data,
# Create the species table for select input.
title <- c('A', 'B', 'C')
code <- c('1', '2', '3')
species <- data.frame(title, code)
# Set choices of title and code for select input.
choicesSpecies <- setNames(species$code, species$title)
Shiny's ui.R,
selectInput(inputId = "species",
label = "Species:",
choices = choicesSpecies),
I get this error,
Error in (function (choice, name) :
All sub-lists in "choices" must be named.
What does it mean? How can I fix it to get the result that I need?