R/whatToDo.R

Defines functions whatToDo

Documented in whatToDo

#' Enables to choose between options
#'
#' @param question Question to be answered
#' @param ... options what to do
#'
#' @return
#' @export
#'
#'
whatToDo <- function(question, ...) {

  options <- c(...)

  what <- ""

  while(!(what %in% options)) {

    what <- readline(paste0(question, " (", paste(options, collapse =  "/"), ") "))

    if(grepl("[[:digit:]]", what)) {
      what <- options[as.numeric(what)]
    }

  }


  what

}
nicohuttmann/htmnanalysis documentation built on Dec. 6, 2020, 3:02 a.m.