#' Creates menu dataframe with an OPTION variable for user interactive selection
#' @param ... variables to be returned in the menu
#' @importFrom dplyr mutate
#' @importFrom dplyr select
#' @export
create_menu <-
function(dataframe, ...) {
menu_vars <- enquos(...)
if (length(menu_vars) == 0) {
dataframe %>%
dplyr::mutate(OPTION = paste0("[", 1:dplyr::n(), "]")) %>%
dplyr::select(OPTION, everything())
} else {
dataframe %>%
dplyr::mutate(OPTION = paste0("[", 1:dplyr::n(), "]")) %>%
dplyr::select(OPTION, !!!menu_vars)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.